Module 6: Production Environments | Intermediate UVM

Multiple-Interface Environments

Learn how to integrate multiple protocol agents into one reusable UVM environment while keeping configuration, stimulus ownership, transaction flow, and cross-interface checking manageable.

Learning objectives

  • Explain the architecture of a UVM environment containing multiple protocol agents.
  • Assign active/passive ownership independently for each interface.
  • Configure multiple agent instances with independent configuration objects.
  • Connect transactions from different agents to appropriate scoreboards, predictors, coverage, and analysis components.
  • Recognize when interfaces should be checked independently and when cross-interface correlation is required.
  • Coordinate activity across interfaces without creating unnecessary dependencies between protocol agents.
  • Debug configuration, TLM connectivity, and cross-interface failures systematically.

Step 1: Understand the concept

A production-level DUT rarely exposes only one interface. A subsystem might contain a register bus, an interrupt interface, a streaming data port, and a sideband control interface. A larger SoC may contain several instances of the same protocol plus several completely different protocols.

In UVM, the usual solution is to give each protocol its own reusable agent and compose those agents inside an environment.

Core architecture: each agent owns protocol-specific stimulus and observation. The environment owns the relationships between interfaces.

For example:

                    subsystem_env
                     |
      +--------------+--------------+
      |              |              |
  bus_agent      stream_agent    irq_agent
      |              |              |
   monitor        monitor        monitor
   driver         driver
   sequencer      sequencer
      |              |              |
      +--------------+--------------+
                     |
             checking / coverage

The important boundary is that the bus agent should understand the bus protocol, not the interrupt protocol. Likewise, the interrupt agent should not contain knowledge of register transactions merely because a particular test happens to connect the two behaviors.

Multiple interfaces are not automatically a cross-interface problem

Having several interfaces does not mean every transaction must be correlated with every other transaction. First determine whether the interfaces are:

  • Independent: each interface has its own checking and coverage requirements.
  • Related: activity on one interface affects expected behavior on another.
  • Cross-correlated: a specific transaction or event on one interface must be matched with a transaction or event on another.

For example, an interrupt may be caused by a bus write. The bus and interrupt agents should remain protocol-independent, while an environment-level checker can verify the relationship between the observed bus transaction and the resulting interrupt.

Architectural rule: keep protocol knowledge inside agents; put subsystem-level relationships above the agents.

Step 2: Build the environment topology

Start by identifying the interfaces and deciding which UVM agent represents each one.

Consider a subsystem with:

  • an APB-style register interface,
  • a streaming data interface, and
  • an interrupt output.

A reusable environment might look like this:

class subsystem_env extends uvm_env;


`uvm_component_utils(subsystem_env)

bus_agent       bus;
stream_agent    stream;
interrupt_agent irq;

subsystem_scoreboard scoreboard;
subsystem_coverage  coverage;

function new(string name, uvm_component parent);
super.new(name, parent);
endfunction

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


bus      = bus_agent::type_id::create("bus", this);
stream   = stream_agent::type_id::create("stream", this);
irq      = interrupt_agent::type_id::create("irq", this);

scoreboard = subsystem_scoreboard::type_id::create(
    "scoreboard", this);

coverage = subsystem_coverage::type_id::create(
    "coverage", this);


endfunction

endclass

Each agent has a unique instance name. This is important because those names become part of the UVM hierarchy and are used when configuring individual instances.

The resulting topology is conceptually:

uvm_test_top


|
+-- env
|
+-- bus
|   +-- sequencer
|   +-- driver
|   +-- monitor
|
+-- stream
|   +-- sequencer
|   +-- driver
|   +-- monitor
|
+-- irq
|   +-- monitor
|
+-- scoreboard
+-- coverage

Do not create protocol components directly in the test merely because the test uses several interfaces. The environment should own the reusable topology; the test should select scenarios and configuration.

Step 3: Configure each interface independently

Lesson 51 introduced active and passive agent strategy. With multiple interfaces, the same idea must be applied per agent instance.

For example, the testbench might own register-bus and stream stimulus while the interrupt interface remains passive:

bus_agent_cfg bus_cfg;


stream_agent_cfg stream_cfg;
interrupt_agent_cfg irq_cfg;

function void build_phase(uvm_phase phase);
bus_cfg = bus_agent_cfg::type_id::create("bus_cfg");
bus_cfg.is_active = UVM_ACTIVE;

stream_cfg = stream_agent_cfg::type_id::create("stream_cfg");
stream_cfg.is_active = UVM_ACTIVE;

irq_cfg = interrupt_agent_cfg::type_id::create("irq_cfg");
irq_cfg.is_active = UVM_PASSIVE;

uvm_config_db#(bus_agent_cfg)::set(
this, "env.bus", "cfg", bus_cfg);

uvm_config_db#(stream_agent_cfg)::set(
this, "env.stream", "cfg", stream_cfg);

uvm_config_db#(interrupt_agent_cfg)::set(
this, "env.irq", "cfg", irq_cfg);

super.build_phase(phase);
endfunction

Each configuration object belongs to one agent instance. This avoids a common multi-interface failure where a wildcard configuration unintentionally gives several agents the same virtual interface, active/passive mode, or protocol settings.

Check the hierarchy: env.bus, env.stream, and env.irq are different configuration targets. When several instances exist, precise paths are usually easier to reason about than broad wildcard settings.

Multiple instances of the same protocol

The same principle applies when a subsystem contains two instances of the same protocol.

class subsystem_env extends uvm_env;


`uvm_component_utils(subsystem_env)

bus_agent master_bus;
bus_agent debug_bus;

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


master_bus = bus_agent::type_id::create("master_bus", this);
debug_bus  = bus_agent::type_id::create("debug_bus", this);


endfunction
endclass

These are two instances of the same reusable agent type, but they may have different virtual interfaces and different active/passive modes.

This is one of the major benefits of UVM composition: reuse the protocol implementation while keeping instance-specific configuration outside the agent class.

Step 4: Connect monitor data to the right consumers

Once the topology exists, determine how observed transactions flow through the environment.

Suppose the bus monitor publishes register transactions and the stream monitor publishes data transactions. They may have independent consumers:

bus.monitor.ap       --> bus_scoreboard
                 --> coverage


stream.monitor.ap    --> stream_scoreboard
--> coverage

irq.monitor.ap       --> irq_checker
--> coverage

If the subsystem has a cross-interface requirement, an additional component can consume the relevant streams:

bus.monitor.ap       --> cross_interface_checker


irq.monitor.ap       --> cross_interface_checker

The important point is that the bus monitor does not need a direct reference to the interrupt monitor. Both publish transactions through TLM, and the higher-level checker decides whether their relationship matters.

Example cross-interface checker

Imagine the specification says that a particular bus operation causes an interrupt. The checker can receive both transaction types:

class interrupt_checker extends uvm_component;


`uvm_component_utils(interrupt_checker)

uvm_analysis_imp #(bus_item, interrupt_checker) bus_imp;
uvm_analysis_imp #(irq_item, interrupt_checker) irq_imp;

function new(string name, uvm_component parent);
super.new(name, parent);


bus_imp = new("bus_imp", this);
irq_imp = new("irq_imp", this);


endfunction

function void write(bus_item item);
// Record bus activity relevant to interrupt generation.
endfunction

function void write(irq_item item);
// Check or correlate the observed interrupt.
endfunction

endclass
Important SystemVerilog detail: two uvm_analysis_imp declarations using the standard write(T) interface cannot simply overload the method by transaction type in every UVM implementation pattern. When a component needs multiple differently typed analysis inputs, use distinct implementation/delegation mechanisms such as uvm_analysis_imp_decl or analysis FIFOs with separate consuming processes.

A common scalable approach is to declare separate analysis implementation suffixes:

`uvm_analysis_imp_decl(_bus)


`uvm_analysis_imp_decl(_irq)

class interrupt_checker extends uvm_component;
`uvm_component_utils(interrupt_checker)

uvm_analysis_imp_bus #(bus_item, interrupt_checker) bus_imp;
uvm_analysis_imp_irq #(irq_item, interrupt_checker) irq_imp;

function new(string name, uvm_component parent);
super.new(name, parent);


bus_imp = new("bus_imp", this);
irq_imp = new("irq_imp", this);


endfunction

function void write_bus(bus_item item);
// Handle bus transactions.
endfunction

function void write_irq(irq_item item);
// Handle interrupt transactions.
endfunction

endclass

This keeps the two transaction types distinct while allowing one higher-level checker to understand their relationship.

Step 5: Keep stimulus coordination above the agents

Multiple active interfaces often need coordinated stimulus. For example, a test may need to:

  1. configure the DUT through the register bus,
  2. start a stream transaction,
  3. wait for the DUT to produce an interrupt, and
  4. verify the resulting status through the bus.

Do not make the bus driver call the stream driver directly. That creates protocol coupling inside reusable agents.

Instead, use a virtual sequence to coordinate the agents through their sequencers.

class subsystem_vseq extends uvm_sequence #(uvm_sequence_item);


`uvm_object_utils(subsystem_vseq)

subsystem_virtual_sequencer vseqr;

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

task body();
bus_config_seq   cfg_seq;
stream_start_seq stream_seq;


cfg_seq = bus_config_seq::type_id::create("cfg_seq");
stream_seq = stream_start_seq::type_id::create("stream_seq");

cfg_seq.start(vseqr.bus_seqr);
stream_seq.start(vseqr.stream_seqr);

// Additional synchronization can occur here.


endtask
endclass

The virtual sequence expresses the scenario relationship. The individual agents continue to implement their own protocol behavior independently.

Layering rule: agents know how to perform protocol operations; virtual sequences know how operations across agents should be coordinated.

This becomes especially important as the environment grows. A test should not need to understand the internal driver implementation of every interface just to create a subsystem scenario.

Step 6: Connect the virtual interfaces correctly

Each agent instance normally needs the virtual interface corresponding to the physical DUT interface it monitors or drives.

For example:

interface bus_if(input logic clk);


logic        valid;
logic        ready;
logic [31:0] addr;
logic [31:0] data;
endinterface

interface stream_if(input logic clk);
logic        valid;
logic        ready;
logic [31:0] data;
endinterface

The testbench should assign the correct interface handle to each configuration object:

bus_cfg.vif    = bus_vif;


stream_cfg.vif = stream_vif;
irq_cfg.vif    = irq_vif;

With multiple interfaces, accidentally assigning the same virtual interface to two agents is a particularly dangerous configuration error. The simulation may compile and the UVM hierarchy may look correct while one agent is observing or driving the wrong signals.

A useful diagnostic is to report the resolved configuration at build time and verify the interface mapping before starting stimulus.

Step 7: Decide where checking belongs

A multi-interface environment usually contains several levels of checking.

Requirement Good location
Bus protocol legality Bus agent assertions/checker or bus-specific monitor
Stream protocol legality Stream agent assertions/checker or stream-specific monitor
Expected bus response Bus predictor/scoreboard
Expected stream data Stream predictor/scoreboard
Interrupt timing relative to a bus operation Subsystem-level checker
Coverage of bus × stream scenarios Environment-level coverage model

This separation prevents a single scoreboard from becoming a large collection of unrelated protocol rules.

For example, the bus agent should be able to report that a bus transaction violates its protocol without knowing whether an interrupt is expected. The subsystem-level checker can then focus specifically on the relationship between accepted bus operations and interrupt behavior.

Step 8: Debug a multi-interface environment systematically

Failures in multi-interface environments can originate from the DUT, stimulus, configuration, TLM connections, or the cross-interface checker. Debug from the bottom of the architecture upward.

  1. Verify the interface mapping. Confirm that every agent received the correct virtual interface.
  2. Verify active/passive mode. Make sure only intended agents are driving.
  3. Verify monitor reconstruction. Confirm each monitor publishes correct transactions independently.
  4. Verify TLM connections. Check that every required analysis port reaches its intended consumer.
  5. Verify stimulus ordering. If multiple sequences are coordinated, inspect the virtual sequence and synchronization points.
  6. Verify correlation rules. A cross-interface checker must define how transactions are related rather than assuming simulation arrival order.
  7. Inspect reset behavior. Clear or reinitialize outstanding cross-interface state when the protocol requires a new transaction epoch.

A useful failure classification

  • No traffic: inspect sequence start, active/passive mode, sequencer/driver connection, and virtual interface.
  • Traffic on the wrong interface: inspect virtual-interface configuration.
  • One interface works but another is silent: inspect that agent's configuration and TLM path independently.
  • Independent scoreboards pass but cross-check fails: inspect correlation rules and timing assumptions.
  • Cross-check sometimes fails: look for scheduling assumptions, missing buffering, ambiguous event boundaries, or race-prone synchronization.

Step 9: Build a reusable multi-interface environment

A reusable environment should not assume that every test uses every interface actively.

For example:

Test A:


bus       = ACTIVE
stream    = ACTIVE
interrupt = PASSIVE

Test B:
bus       = PASSIVE
stream    = ACTIVE
interrupt = PASSIVE

Test C:
bus       = ACTIVE
stream    = PASSIVE
interrupt = PASSIVE

The topology can remain unchanged while configuration and stimulus ownership change.

This is particularly valuable when moving from block-level verification to subsystem-level verification. At block level, the testbench may actively drive an interface. At subsystem level, another verified component may already own that interface, so the same agent becomes passive and continues providing observation.

Production design goal: reuse the environment topology while changing configuration and scenario intent, rather than creating a different environment for every verification level.

Try it yourself

Design a UVM environment for a subsystem containing:

  • one register-bus interface,
  • two streaming interfaces, and
  • one interrupt interface.
  1. Create an agent for each interface.
  2. Decide which agents are active and which are passive.
  3. Give each agent its own configuration object and virtual interface.
  4. Connect each monitor to its independent checking or coverage consumer.
  5. Identify one requirement that crosses two interfaces.
  6. Design a higher-level checker for that relationship without modifying either protocol agent.
  7. Create a virtual-sequence scenario that coordinates the register and stream agents.

Debugging exercise: deliberately configure the stream agent with the wrong virtual interface. Determine what evidence in the logs, monitor transactions, and waveform would reveal the problem.

Challenge: configure the two stream-agent instances differently—one active and one passive—while keeping the same stream_agent class for both.

Knowledge check

  1. Why should each protocol normally have its own UVM agent?
  2. Where should a relationship between two protocols usually be checked?
  3. Why is a separate configuration object useful for each agent instance?
  4. Why should a bus driver avoid directly invoking a stream driver?
  5. What is the role of a virtual sequence in a multi-interface environment?
  6. What should you inspect if two agents appear in the correct UVM hierarchy but one observes the wrong DUT signals?
  7. Why can a cross-interface checker not safely assume that transaction callback order represents protocol order?
Self-check: if you can explain the path interface → monitor → analysis TLM → checker for each interface, and separately explain how a virtual sequence coordinates active agents, you understand the core architecture of this lesson.

Production design notes

  • Give each interface a clear owner. Avoid multiple active drivers competing for the same physical interface unless the protocol explicitly supports that architecture.
  • Use separate agent configurations. Virtual interfaces, active/passive mode, protocol options, and timing settings often differ by instance.
  • Keep protocol agents independent. Cross-interface behavior belongs at the environment or subsystem level.
  • Prefer TLM connections over direct component references. This keeps producers and consumers replaceable and easier to reuse.
  • Coordinate stimulus with virtual sequences. Do not embed subsystem scenarios inside individual protocol drivers.
  • Do not infer correlation from callback order. If two streams are related, define an explicit key, event, timestamp, transaction state, or buffering strategy.
  • Verify virtual-interface mapping early. A wrong interface handle can produce convincing but completely misleading monitor data.
  • Keep independent checks independent. A bus protocol failure should not require a subsystem-level checker to diagnose it.
  • Design for partial activation. A reusable environment should allow one interface to be active while another is passive when verification ownership changes.

Key takeaways

  • A multiple-interface UVM environment composes reusable agents rather than creating one large protocol-specific component.
  • Each agent should retain ownership of its own protocol behavior, configuration, monitor, and stimulus components.
  • Active/passive mode is selected independently for each interface instance.
  • The environment connects monitor transactions to scoreboards, predictors, coverage, and cross-interface checkers through TLM.
  • Relationships between protocols belong above the individual agents.
  • Virtual sequences coordinate scenarios across active agents without coupling protocol implementations together.
  • Cross-interface checking must use explicit correlation or synchronization rather than relying on simulator callback order.
  • Correct virtual-interface mapping, configuration, TLM connectivity, and reset handling are essential to reliable multi-interface verification.

What comes next?

In Lesson 53, Protocol Agent Contracts, you will take the reusable-agent idea one step further. Instead of looking only at how several agents are composed, you will define what a protocol agent must expose to the rest of the environment—its configuration, transactions, analysis streams, sequencers, and supported operating modes—so that different implementations can be integrated without rewriting the surrounding environment.