Active and Passive Agents
Learn how to configure a UVM agent to either generate DUT traffic or passively observe an existing interface, making the same verification component reusable across different environments.
Learning objectives
- Explain the difference between active and passive UVM agents.
- Identify which components are normally present in each agent mode.
- Configure an agent using
uvm_active_passive_enum. - Build an agent that conditionally creates its driver and sequencer.
- Understand why passive agents are useful for monitoring existing DUT traffic.
- Connect the monitor correctly in both active and passive modes.
Step 1: Understand what an agent represents
A UVM agent groups the components responsible for interacting with one DUT interface or protocol.
A typical bus agent contains:
bus_agent
|
+-- sequencer
|
+-- driver
|
+-- monitor
The components have different responsibilities:
| Component | Purpose |
|---|---|
| Sequencer | Manages transaction requests from sequences. |
| Driver | Converts transactions into DUT interface activity. |
| Monitor | Observes interface activity and publishes transactions. |
The important question is: Does this agent need to generate traffic, or only observe traffic?
That is where active and passive modes come in.
Step 2: Understand active mode
An active agent can generate stimulus for the interface.
Sequence
|
v
Sequencer
|
v
Driver
|
v
DUT Interface
|
v
DUT
The monitor normally remains present so the testbench can observe what actually happened.
Active Agent
+-----------------------------+
| |
| Sequencer --> Driver ----+ |
| | |
| Monitor <----------------+ |
| | |
+----|------------------------+
|
v
Scoreboard / Coverage
Active mode is commonly used when the UVM environment is responsible for driving transactions into the DUT.
For example, a test might start:
bus_sequence seq;
seq = bus_sequence::type_id::create("seq");
seq.start(env.agent.sequencer);
The sequence generates transaction intent, the sequencer manages it, and the driver performs the protocol-level pin activity.
Step 3: Understand passive mode
A passive agent does not generate stimulus. It observes an interface that is being driven by something else.
External Driver / DUT
|
v
DUT Interface
|
v
Monitor
|
v
Scoreboard / Coverage
The monitor remains active because observation is still required. What disappears is the stimulus-generation side of the agent.
Passive Agent
+-----------------------------+
| |
| Sequencer not needed |
| Driver not needed |
| |
| Monitor ----------------+ |
+--------------------------|---+
|
v
Scoreboard / Coverage
This makes passive agents especially useful when another component or another verification environment already controls the interface.
Step 4: Compare active and passive agents
| Feature | Active agent | Passive agent |
|---|---|---|
| Monitor | Yes | Yes |
| Driver | Yes | No |
| Sequencer | Usually yes | No |
| Generates DUT stimulus | Yes | No |
| Observes DUT activity | Yes | Yes |
| Useful for coverage | Yes | Yes |
| Useful for scoreboards | Yes | Yes |
The monitor is the key component shared by both modes.
Step 5: Configure the agent mode
UVM provides uvm_active_passive_enum for this purpose.
uvm_active_passive_enum is_active = UVM_ACTIVE;
The two values used most often are:
UVM_ACTIVE
UVM_PASSIVE
An agent can use the configuration to decide whether to construct its stimulus-generation components.
class bus_agent extends uvm_agent;
`uvm_component_utils(bus_agent)
bus_sequencer sequencer;
bus_driver driver;
bus_monitor monitor;
uvm_active_passive_enum is_active = UVM_ACTIVE;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
endclass
Notice that the mode is a property of the agent. The test can therefore reuse the same agent architecture while changing how that interface is used.
Step 6: Conditionally create the components
In build_phase(), the agent always creates its monitor, but creates the sequencer and driver only when the agent is active.
function void build_phase(uvm_phase phase);
super.build_phase(phase);
monitor = bus_monitor::type_id::create(
"monitor", this);
if (is_active == UVM_ACTIVE) begin
sequencer = bus_sequencer::type_id::create(
"sequencer", this);
driver = bus_driver::type_id::create(
"driver", this);
end
endfunction
This produces two possible topologies.
Active
bus_agent
├── sequencer
├── driver
└── monitor
Passive
bus_agent
└── monitor
The monitor's behavior does not need to change just because the agent is passive.
Step 7: Connect only what exists
The active agent needs a sequencer-to-driver connection. A passive agent does not have those components.
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
if (is_active == UVM_ACTIVE) begin
driver.seq_item_port.connect(
sequencer.seq_item_export
);
end
endfunction
The monitor can connect to the environment regardless of the agent mode:
agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);
This is an important design pattern:
Common to both modes:
Monitor → Analysis → Checking/Coverage
Active only:
Sequence → Sequencer → Driver → DUT
Step 8: Why passive agents matter
Real verification environments often contain multiple interfaces.
Imagine a DUT with:
+----------------+
| DUT |
| |
Bus A ------>| |<------ Bus B
| |
+----------------+
You might actively drive Bus A while another block or subsystem controls Bus B.
Bus A Agent
|
+-- ACTIVE
|
+-- Driver generates traffic
+-- Monitor observes traffic
Bus B Agent
|
+-- PASSIVE
|
+-- Monitor observes traffic
+-- No driver
+-- No sequencer
The same overall environment can therefore combine active and passive agents.
Environment
|
+--------------+--------------+
| |
Bus A Agent Bus B Agent
ACTIVE PASSIVE
| |
Driver + Monitor Monitor
| |
+-------------+---------------+
|
v
Scoreboard / Coverage
This is one of the reasons UVM agents are valuable: they package protocol-specific behavior into reusable units that can be configured for different environments.
Step 9: Configure the agent from the environment
The environment can select the desired mode during build.
function void build_phase(uvm_phase phase);
super.build_phase(phase);
active_agent = bus_agent::type_id::create(
"active_agent", this);
passive_agent = bus_agent::type_id::create(
"passive_agent", this);
active_agent.is_active = UVM_ACTIVE;
passive_agent.is_active = UVM_PASSIVE;
endfunction
A more scalable environment will typically obtain configuration from a configuration object or configuration database rather than hard-coding the mode. That allows the same environment to be reused without editing the agent itself.
The key architectural idea is:
Step 10: Debug active/passive agent problems
| Symptom | What to check |
|---|---|
| Passive agent has no transactions | Check the monitor, virtual interface, clock, reset, and sampling condition. |
| Passive agent causes null-handle errors | Check that code does not use driver or sequencer handles in passive mode. |
| Driver does not receive items | Confirm the agent is active and the sequencer-to-driver connection exists. |
| Monitor works in active mode but not passive mode | Check the monitor independently; its observation logic should normally be shared. |
| Unexpected DUT contention | Check whether an agent is active when another component already drives the interface. |
| Topology looks wrong | Print the UVM topology and verify which components were constructed. |
A topology print is particularly useful:
uvm_root::get().print_topology();
If an agent is intended to be passive but its topology contains a driver, investigate the agent's configuration and build logic.
Try it yourself
Build a bus_agent that supports both active and passive operation.
- Create a monitor that works in both modes.
- Create the sequencer and driver only when
is_active == UVM_ACTIVE. - Connect the sequencer to the driver only in active mode.
- Connect the monitor's analysis port to a scoreboard in both modes.
- Run an active test and verify that the agent can drive transactions.
- Run a passive test with an external source driving the interface.
- Print the UVM topology in both tests and compare the component trees.
Challenge: Create an environment containing two agents for the same protocol. Configure one as active and the other as passive. Explain why only one driver should control each physical interface.
Key takeaways
- An active agent can generate stimulus and observe the interface.
- A passive agent observes the interface but does not drive it.
- The monitor is normally present in both active and passive modes.
uvm_active_passive_enumlets an agent selectUVM_ACTIVEorUVM_PASSIVE.- In passive mode, the driver and sequencer generally should not be created.
- Agent configuration makes the same protocol component reusable in different environments.
- Multiple agents can be active or passive independently, depending on who owns each interface.
Core mental model
ACTIVE AGENT
Sequence
|
v
Sequencer
|
v
Driver
|
v
DUT Interface
|
v
Monitor
|
v
Scoreboard / Coverage
PASSIVE AGENT
External Source
|
v
DUT Interface
|
v
Monitor
|
v
Scoreboard / Coverage
Active means drive and observe. Passive means observe only.
What comes next?
Now that you understand how an agent can operate in different modes, the next lesson assembles those pieces into a complete agent architecture. You will see how the sequencer, driver, monitor, configuration, and analysis connections fit together as one reusable UVM component.