Connecting the Environment
Wire agents, monitors, reference models, scoreboards, and coverage together so transactions can flow through a complete UVM verification environment.
Learning objectives
- Explain why UVM components must be explicitly connected.
- Use
connect_phase()to establish TLM communication paths. - Connect monitor analysis ports to scoreboards and coverage components.
- Connect expected transactions from a reference model to a scoreboard.
- Understand the difference between internal agent connections and environment-level connections.
- Verify connections using topology, reports, and transaction flow.
- Debug a complete environment by locating the first broken communication boundary.
Step 1: Why does the environment need connections?
In the previous lessons, you created the components of a UVM environment: agents, drivers, monitors, scoreboards, reference models, and coverage collectors. Creating those components gives you a hierarchy, but it does not automatically define how transactions move between them.
Connections establish the communication paths that turn independent components into one verification system.
Components exist:
Monitor
Scoreboard
Coverage
Reference model
but...
No connection
|
v
No transaction flow
After the appropriate connections are established:
Monitor
|
| observed transaction
+----------> Scoreboard
|
+----------> Coverage
build_phase() creates the components.
connect_phase() establishes communication between them.
Step 2: Know what gets connected where
Not every connection belongs in the same place. A useful architectural distinction is whether the connection is part of a component's internal implementation or part of the verification environment's overall composition.
| Connection | Typical owner | Why? |
|---|---|---|
| Sequencer → Driver | Agent | Both implement the agent's stimulus path |
| Monitor → Scoreboard | Environment | Checking is environment-level infrastructure |
| Monitor → Coverage | Environment | Coverage is a verification consumer |
| Input Monitor → Reference Model | Environment | Prediction is part of the system-level verification architecture |
| Reference Model → Scoreboard | Environment | Expected data must reach the checking component |
The general rule is:
Agent:
"How does this protocol operate?"
Environment:
"How do these verification components cooperate?" Step 3: Review the analysis connection
The most common environment-level connection in the examples from this module is a monitor's analysis port connected to a consumer.
agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);
The monitor publishes an observed transaction:
analysis_port.write(observed);
The connected consumer receives that transaction through its analysis interface.
Monitor
|
| write(transaction)
v
analysis_port
|
v
Scoreboard consumer
The monitor does not call a scoreboard method directly. This keeps the producer independent from its consumers.
Step 4: Connect one monitor to multiple consumers
A major benefit of analysis ports is that one observation can be delivered to multiple independent consumers.
Monitor
|
analysis_port
/ | \
/ | \
v v v
Scoreboard Coverage Logger
The environment can establish these connections in its connect_phase():
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);
agent.monitor.analysis_port.connect(
coverage.analysis_export
);
agent.monitor.analysis_port.connect(
logger.analysis_export
);
endfunction
This is a powerful architectural pattern: publish once, analyze many times.
Step 5: Connect expected and actual transactions
A realistic scoreboard often needs two information streams:
- Expected: what the reference model predicts.
- Actual: what the DUT monitor observes.
Input observation
|
v
Reference model
|
| expected
v
+-------------+
| Scoreboard |
+-------------+
^
| actual
|
Output monitor
^
|
DUT
The environment is responsible for wiring these paths together.
input_agent.monitor.analysis_port.connect(
reference_model.input_export
);
reference_model.expected_port.connect(
scoreboard.expected_export
);
output_agent.monitor.analysis_port.connect(
scoreboard.actual_export
);
The exact TLM port/export/implementation types depend on the component interfaces, but the architectural idea remains the same: expected and actual information must reach the checker through explicit communication paths.
Step 6: Build the complete environment connection graph
Consider a simple DUT with separate input and output interfaces:
system_env
+-------------------------------------+
| |
| input_agent |
| | |
| | observed input |
| v |
| reference_model |
| | |
| | expected output |
| v |
| +------------+ |
| | scoreboard |<----------------+ |
| +------------+ | |
| | |
| output_agent.monitor ---------+ |
| | |
| v |
| coverage |
| |
+-------------------------------------+
input_agent
|
v
DUT
|
v
output_agent
This graph is much more useful than thinking about the components as isolated classes. Verification architecture is fundamentally about data flow.
Step 7: Put the connections in the environment
A compact environment might look like this:
class bus_env extends uvm_env;
`uvm_component_utils(bus_env)
bus_agent agent;
bus_scoreboard scoreboard;
bus_coverage coverage;
function new(string name = "bus_env",
uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
agent = bus_agent::type_id::create(
"agent", this);
scoreboard = bus_scoreboard::type_id::create(
"scoreboard", this);
coverage = bus_coverage::type_id::create(
"coverage", this);
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);
agent.monitor.analysis_port.connect(
coverage.analysis_export
);
endfunction
endclass
Notice that the environment does not manipulate signals. It only connects UVM communication interfaces.
Step 8: Understand connection direction
When debugging a connection, identify the producer and the consumer.
Producer
|
| transaction
v
Consumer
For an analysis path:
Monitor
|
| publishes
v
Analysis port
|
v
Analysis consumer
|
| receives
v
Scoreboard / Coverage / Subscriber
If the producer generates transactions but the consumer receives nothing, the connection path should be inspected before changing the producer's behavior.
Step 9: Internal agent connection versus environment connection
This distinction is important enough to memorize.
AGENT
+----------------+
| |
| Sequencer |
| | |
| v |
| Driver |
| |
| Monitor |
+-------|--------+
|
| analysis transaction
v
ENVIRONMENT
+----------------+
| |
| Scoreboard |
| Coverage |
| Reference model|
| |
+----------------+
The agent connects components that are required to make that protocol interface operate. The environment connects protocol observations to verification-specific consumers.
Step 10: Connect active and passive agents
Passive agents still produce useful observations. Their lack of a driver does not prevent their monitor from publishing transactions.
active_agent
sequencer
|
driver
|
v
DUT
|
v
passive_agent
monitor
|
+------> scoreboard
|
+------> coverage
The environment can therefore combine active and passive interfaces without creating special monitoring architectures for each mode.
For example:
input_agent = UVM_ACTIVE;
output_agent = UVM_PASSIVE;
The input agent generates stimulus while the output agent observes DUT behavior.
Step 11: Verify connections with topology
Before debugging transaction behavior, verify that the expected component hierarchy exists.
function void end_of_elaboration_phase(
uvm_phase phase
);
super.end_of_elaboration_phase(phase);
uvm_root::get().print_topology();
endfunction
You want to see something similar to:
uvm_test_top
└── env
├── agent
│ ├── sequencer
│ ├── driver
│ └── monitor
├── scoreboard
└── coverage
Topology proves that components were constructed. It does not by itself prove that their TLM connections are correct, so transaction flow must still be verified.
Step 12: Add evidence to every important boundary
Reports make connection debugging much easier. Give each major component a useful message ID.
// Driver
`uvm_info("DRV", "Driving transaction", UVM_MEDIUM)
// Monitor
`uvm_info("MON", "Publishing observed transaction",
UVM_MEDIUM)
// Scoreboard
`uvm_info("SB", "Received transaction for checking",
UVM_MEDIUM)
// Coverage
`uvm_info("COV", "Received transaction",
UVM_HIGH)
Then trace the same transaction through the environment:
DRV
|
v
DUT
|
v
MON
|
+----> SB
|
+----> COV
If the monitor reports the transaction but the scoreboard does not, the problem is likely between the monitor and scoreboard rather than in the driver.
Step 13: Common connection mistakes
| Mistake | Symptom | Fix |
|---|---|---|
Forgetting connect_phase() |
Components exist but no transactions arrive | Add the required TLM connections |
| Connecting the wrong port | Consumer receives nothing or compilation fails | Verify producer and consumer interface types |
| Connecting monitor to the wrong scoreboard | Unexpected transactions appear in checking | Trace instance names and intended data flow |
| Putting scoreboard connections inside the agent | Agent becomes tightly coupled to one environment | Make verification-consumer connections at environment level |
| Assuming topology proves TLM connectivity | Hierarchy looks correct but consumers receive nothing | Verify actual transaction flow with reports |
| Connecting before components are created | Null handles or invalid connections | Create components in build before connecting them |
| Forgetting a passive monitor connection | Passive interface produces no checking/coverage data | Connect its analysis port like any other monitor |
Step 14: Debug a missing transaction systematically
Suppose the sequence ran, but the scoreboard says it received zero transactions. Do not immediately rewrite the scoreboard.
Sequence
|
? Did sequence create an item?
|
v
Sequencer
|
? Did driver receive it?
|
v
Driver
|
? Did driver drive the DUT?
|
v
DUT
|
? Did a valid protocol transfer occur?
|
v
Monitor
|
? Did monitor detect and publish it?
|
v
Analysis connection
|
? Is the port connected?
|
v
Scoreboard
|
? Did consumer receive it?
This gives you a deterministic debugging method:
- Verify the sequence generated a transaction.
- Verify the sequencer delivered it to the driver.
- Verify the driver created the expected DUT interface activity.
- Verify the DUT accepted the transfer.
- Verify the monitor recognized the protocol boundary.
- Verify the monitor called its analysis port.
- Verify the analysis connection exists.
- Verify the scoreboard received the transaction.
Step 15: The complete verification data flow
You now have enough pieces to see the complete beginner UVM architecture.
TEST
|
| starts sequence
v
+-----------+
| SEQUENCER |
+-----+-----+
|
sequence item
|
v
+-----------+
| DRIVER |
+-----+-----+
|
protocol signals
|
v
+-----------+
| DUT |
+-----+-----+
|
interface activity
|
v
+-----------+
| MONITOR |
+-----+-----+
|
observed transaction
/ \
v v
SCOREBOARD COVERAGE
^
|
expected data
|
REFERENCE MODEL
The key is not memorizing the boxes. The key is understanding the direction of information:
Stimulus:
Test → Sequence → Sequencer → Driver → DUT
Observation:
DUT → Monitor → Analysis connections
Checking:
Observed + Expected → Scoreboard
Measurement:
Observed → Coverage Try it yourself
Build and connect a complete small UVM environment for a counter or FIFO.
- Create an active agent for the DUT input interface.
- Create a monitor that publishes observed transactions.
- Create a scoreboard.
- Create a coverage subscriber.
- Connect the monitor analysis port to both scoreboard and coverage.
- Verify the agent's internal sequencer-driver connection.
- Start a short directed sequence from a UVM test.
- Use
uvm_infomessages to trace one transaction through the environment. - Print the topology and verify that the expected components exist.
- Intentionally disconnect the scoreboard, run the test, and observe the difference.
- Restore the connection and verify that checking resumes.
Key takeaways
- Creating UVM components establishes hierarchy; connecting them establishes communication.
- Use
connect_phase()for TLM and other component communication connections. - The agent owns its internal protocol connections, such as sequencer to driver.
- The environment normally connects monitor observations to scoreboards, coverage, and reference models.
- One analysis port can distribute observations to multiple consumers.
- Expected and actual transaction streams can be connected to a scoreboard for comparison.
- Topology verifies component existence; transaction reports verify communication flow.
- When debugging, find the first boundary where the expected transaction disappears.
Core mental model
Think of connect_phase() as the moment when your collection of UVM
components becomes a verification system.
BUILD
|
v
Components exist
|
v
CONNECT
|
v
Components communicate
|
v
RUN
|
v
Transactions flow
|
v
CHECK + COVERAGE
|
v
Verification
evidence
And remember the complete flow:
Generate
↓
Drive
↓
DUT
↓
Observe
↓
Publish
↓
Check / Measure
Build creates the pieces. Connect wires the pieces. Run moves the transactions.
What comes next?
You have now assembled the architecture of a complete beginner UVM environment. The next lessons will put this architecture to work in real verification scenarios, starting with a Counter Verification Lab. You will use the same agent, environment, test, stimulus, monitor, and scoreboard concepts to verify an actual design behavior.