Module 6: Production Environments | Intermediate UVM

Active and Passive Agent Strategy

Learn how to decide whether a UVM agent should drive DUT signals, monitor existing activity, or switch between both roles as the environment evolves.

Learning objectives

  • Explain the difference between active and passive UVM agents and when each mode is appropriate.
  • Configure an agent so its driver is enabled only when the testbench owns stimulus generation.
  • Design an environment that can reuse the same agent in block-level, subsystem, and system-level verification.
  • Validate agent mode through configuration, simulation activity, and UVM report messages.

Step 1: Understand the concept

An agent groups the verification components that understand a particular interface. A typical agent contains a sequencer, driver, and monitor. The important architectural question is whether the agent should control the interface or simply observe it.

Active agent: the sequencer and driver generate stimulus for the DUT, while the monitor observes the resulting activity.
Passive agent: the monitor remains active, but the sequencer and driver do not generate interface activity. The agent is used for observation and checking.

This distinction becomes especially useful as a verification environment grows. At block level, a bus agent may need to be active because the testbench performs reads and writes. At subsystem or system level, another master may already generate that traffic, so the same bus agent can be configured as passive and used only to monitor transactions.

Why use the same agent in both modes?

Keeping active/passive behavior inside the agent avoids maintaining separate implementations for stimulus and observation. The interface protocol knowledge stays in one reusable component, while the test or environment decides who owns stimulus generation.

A useful rule is:

Configure ownership; do not duplicate protocol knowledge.

Step 2: Study the example

Start with a configuration object that describes the agent's operating mode. The agent can then create its driver and sequencer only when active.

typedef enum { UVM_ACTIVE, UVM_PASSIVE } agent_mode_e;


class bus_agent_cfg extends uvm_object;
`uvm_object_utils(bus_agent_cfg)

agent_mode_e mode = UVM_ACTIVE;

function new(string name = "bus_agent_cfg");
super.new(name);
endfunction
endclass

The agent reads this configuration during build_phase:

class bus_agent extends uvm_agent;


`uvm_component_utils(bus_agent)

bus_agent_cfg cfg;
bus_sequencer sequencer;
bus_driver    driver;
bus_monitor   monitor;

function void build_phase(uvm_phase phase);
super.build_phase(phase);


if (!uvm_config_db#(bus_agent_cfg)::get(
      this, "", "cfg", cfg)) begin
  `uvm_fatal("CFG", "bus_agent_cfg was not provided")
end

monitor = bus_monitor::type_id::create("monitor", this);

if (cfg.mode == UVM_ACTIVE) begin
  sequencer = bus_sequencer::type_id::create("sequencer", this);
  driver    = bus_driver::type_id::create("driver", this);
end


endfunction
endclass

Notice the architectural decision: the monitor exists in both modes. Only the stimulus-producing components depend on the active/passive setting.

Connecting only what exists

The agent should also guard its TLM connection so a passive agent does not attempt to connect a driver that was never created.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

if (cfg.mode == UVM_ACTIVE)
driver.seq_item_port.connect(sequencer.seq_item_export);
endfunction

At the environment level, two interfaces can use different modes without requiring different agent classes:

function void build_phase(uvm_phase phase);


bus_cfg = bus_agent_cfg::type_id::create("bus_cfg");

bus_cfg.mode = UVM_ACTIVE;
uvm_config_db#(bus_agent_cfg)::set(
this, "bus", "cfg", bus_cfg);

irq_cfg = irq_agent_cfg::type_id::create("irq_cfg");

irq_cfg.mode = UVM_PASSIVE;
uvm_config_db#(irq_agent_cfg)::set(
this, "irq", "cfg", irq_cfg);

bus = bus_agent::type_id::create("bus", this);
irq = irq_agent::type_id::create("irq", this);
endfunction

Here the bus agent generates traffic, while the interrupt agent only observes DUT behavior. This pattern scales well when an environment contains several interfaces with different ownership models.

Design check: if switching an agent from active to passive requires modifying the driver, monitor, scoreboard, and testbench topology, the mode boundary is probably in the wrong place. Prefer making the agent itself responsible for its operating mode.

Step 3: Build it in small pieces

  1. Identify interface ownership. For each interface, decide whether the UVM environment, the DUT, or another subsystem is responsible for generating activity.
  2. Create the configuration object. Store the active/passive mode with other agent-specific settings rather than scattering mode flags throughout the environment.
  3. Build the monitor first. Verify that transactions are observed correctly regardless of the selected mode.
  4. Add active behavior. Create the sequencer and driver only when the configuration requires stimulus generation.
  5. Test both modes. Run one scenario with the agent active and another with it passive. Confirm that passive mode produces observations without unexpectedly driving the interface.
  6. Connect consumers explicitly. Route monitor transactions to the scoreboard, coverage collector, or analysis component that needs them.

A practical verification sequence

Suppose a subsystem contains a bus interface and an interrupt interface. Start with the bus agent active so the test can perform a register write. Configure the interrupt agent as passive so it only observes the interrupt generated by the DUT.

bus_cfg.mode = UVM_ACTIVE;


irq_cfg.mode = UVM_PASSIVE;

After the environment works, reverse the bus configuration in a higher-level test where an external master is responsible for bus traffic:

bus_cfg.mode = UVM_PASSIVE;

The monitor and scoreboard can remain unchanged. Only the ownership configuration changes.

Common mistake: treating passive mode as "disable the whole agent." A passive agent should normally continue monitoring. What changes is stimulus ownership, not observability.

Step 4: Validate the architecture

Do not validate active/passive configuration only by checking that the simulation compiles. Look for observable evidence that the selected mode is actually being honored.

  • In active mode, sequences can reach the driver and produce interface activity.
  • In passive mode, no UVM driver should generate transactions on that interface.
  • The monitor should continue publishing transactions in both modes.
  • The scoreboard should receive the expected monitored transactions.
  • Configuration errors should produce a clear UVM fatal report rather than a null-object failure later in the simulation.

A useful debug message can make the selected mode immediately visible:

if (cfg.mode == UVM_ACTIVE)


`uvm_info("AGENT_MODE", "Bus agent configured ACTIVE", UVM_LOW)
else
  `uvm_info("AGENT_MODE", "Bus agent configured PASSIVE", UVM_LOW)

Try it yourself

Create a small environment containing a bus agent and an interrupt agent.

  1. Configure the bus agent as UVM_ACTIVE.
  2. Configure the interrupt agent as UVM_PASSIVE.
  3. Connect both monitors to a scoreboard or analysis component.
  4. Run a register-access scenario that causes an interrupt.
  5. Verify from the simulation log that the bus agent can drive traffic while the interrupt agent only observes it.
  6. Change the bus agent to passive and identify what must change—and what should remain unchanged.

Challenge: add a configuration field that allows the test to select active or passive mode without changing the agent class.

Production design notes

  • Prefer configuration over duplicated agents. One well-designed agent is easier to maintain than separate active and passive implementations.
  • Keep monitors independent. Scoreboards and coverage collectors should not need to know whether the agent is active or passive.
  • Make ownership explicit. At subsystem and system levels, determine which component is allowed to drive each interface.
  • Fail early on invalid configuration. Missing configuration should be reported during build rather than causing confusing failures during run time.
  • Use active mode selectively. Not every interface needs a UVM driver. Passive observation can be the correct architecture for interfaces already controlled elsewhere.

Key takeaways

  • An active agent contains stimulus-producing components such as a sequencer and driver; a passive agent normally retains the monitor without driving the interface.
  • Active/passive mode should be a configuration decision, not a reason to maintain separate agent implementations.
  • The monitor should remain useful in both modes so scoreboards and coverage can observe the interface consistently.
  • Choose agent mode according to interface ownership at the current verification level.
  • Validate the architecture through actual stimulus, monitored transactions, configuration reports, and the absence of unintended driving.