Module 3: Phases and Transactions | Lesson 23

Connect and End-of-Elaboration Phases

Learn how UVM connects components through TLM ports and verifies the completed testbench topology before simulation begins.

Learning objectives

  • Explain the purpose of connect_phase().
  • Understand how UVM components communicate through TLM connections.
  • Connect a monitor's analysis port to a scoreboard.
  • Understand why connections belong in the connect phase rather than the build phase.
  • Explain the purpose of end_of_elaboration_phase().
  • Use topology printing to debug the completed UVM hierarchy.
  • Recognize common connection and hierarchy mistakes.

Step 1: What happens after build?

In Lesson 22, you learned that build_phase() creates the UVM component hierarchy.

For example:

uvm_test_top


└── env
└── agent
├── driver
└── monitor

At this point, the components exist, but they may not yet be connected to each other.

For example, the monitor can observe transactions, and the scoreboard can check transactions, but UVM still needs to know:

monitor ───────────────> scoreboard

This is the job of connect_phase().

Key idea: build_phase() creates the components. connect_phase() connects the communication paths between them.

Step 2: What is connect_phase()?

connect_phase() is a UVM function phase used to establish communication between components.

A typical implementation looks like this:

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

monitor.ap.connect(scoreboard.analysis_export);
endfunction

The important line is:

monitor.ap.connect(scoreboard.analysis_export);

This tells UVM that transactions produced by the monitor's analysis port should be delivered to the scoreboard's analysis implementation.

Think of the connection as wiring two parts of the verification environment together.

Step 3: Understand TLM communication

UVM uses Transaction-Level Modeling (TLM) to let components communicate using transactions instead of directly manipulating DUT signals.

A monitor might observe signals such as:

clk


valid
addr
data
write

It converts those pin-level observations into a transaction:

bus_transaction

The monitor can then publish that transaction through an analysis port:

monitor.ap.write(txn);

A scoreboard can receive the transaction and compare it with expected behavior.

monitor


|
| analysis transaction
v
scoreboard
|
v
compare expected vs actual
Verification mindset: The monitor observes the DUT. The scoreboard decides whether the observed behavior is correct.

Step 4: Analysis ports and exports

A common beginner UVM connection is a monitor's uvm_analysis_port connected to a scoreboard's analysis implementation.

For example, the monitor may contain:

class bus_monitor extends uvm_monitor;


uvm_analysis_port #(bus_transaction) ap;

function new(string name = "bus_monitor",
uvm_component parent = null);
super.new(name, parent);
ap = new("ap", this);
endfunction

endclass

The scoreboard can provide an analysis implementation using uvm_analysis_imp:

class bus_scoreboard extends uvm_scoreboard;


uvm_analysis_imp #(bus_transaction, bus_scoreboard) analysis_export;

function new(string name = "bus_scoreboard",
uvm_component parent = null);
super.new(name, parent);
analysis_export = new("analysis_export", this);
endfunction

function void write(bus_transaction txn);
`uvm_info("SCOREBOARD",
"Received a transaction",
UVM_MEDIUM)
endfunction

endclass

The environment then connects them:

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

monitor.ap.connect(scoreboard.analysis_export);
endfunction

The complete communication path is:

monitor.ap
|
| connect()
v


scoreboard.analysis_export
|
v
scoreboard.write(txn)

Step 5: Why connections belong in connect_phase()

A common beginner mistake is trying to connect components during build_phase().

For example:

function void build_phase(uvm_phase phase);


super.build_phase(phase);

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

// Avoid putting TLM connections here.
endfunction

The problem is architectural clarity. Build is responsible for constructing the hierarchy. Connect is responsible for establishing communication between already-created components.

A clean UVM environment follows this pattern:

build_phase()
|
| create components
v


connect_phase()
|
| connect TLM interfaces
v
end_of_elaboration_phase()
|
| inspect final topology
v
run_phase()
|
| simulation activity
v
checking / reporting
Rule to remember: If you are creating a component, think build_phase(). If you are connecting two existing components, think connect_phase().

Step 6: A complete environment example

Consider an environment containing an agent and scoreboard.

class bus_env extends uvm_env;


bus_agent      agent;
bus_scoreboard scoreboard;

`uvm_component_utils(bus_env)

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);


endfunction

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


agent.monitor.ap.connect(
    scoreboard.analysis_export);


endfunction

endclass

The environment creates both components during build:

env


├── agent
└── scoreboard

Then connect phase establishes the communication path:

env


├── agent
│   └── monitor
│        |
│        | analysis transaction
│        v
└── scoreboard

Notice that the environment does not create the monitor directly. The agent owns its monitor, just as you learned in Lesson 22.

Good architecture: Each component creates its immediate children, while the parent component connects those children to other components it owns.

Step 7: Connect phase is also a function

Like build_phase(), connect_phase() is a function phase.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

// TLM connections go here.
endfunction

Because it is a function phase, you should not consume simulation time inside it.

Do not write time-consuming operations such as:

#10ns;


@(posedge clk);

Those belong in time-consuming phases such as run_phase().

Step 8: What is end_of_elaboration_phase()?

After UVM has finished building and connecting the component hierarchy, it reaches end_of_elaboration_phase().

This phase is useful for inspecting or validating the final testbench structure before simulation begins.

A simple example is:

function void end_of_elaboration_phase(uvm_phase phase);


super.end_of_elaboration_phase(phase);

`uvm_info("ENV",
"End of elaboration reached",
UVM_LOW)
endfunction

One of the most useful debugging operations is printing the UVM topology:

uvm_root::get().print_topology();

This lets you inspect the component tree that UVM actually constructed.

Step 9: Verify the topology before running traffic

Suppose you expected this environment:

uvm_test_top


└── env
├── agent
│   ├── driver
│   └── monitor
└── scoreboard

But your topology output shows:

uvm_test_top


└── env
└── agent
├── driver
└── monitor

The scoreboard is missing.

Before debugging transactions, clocks, drivers, or randomization, fix the hierarchy.

This is an important verification habit:

1. Verify hierarchy


2. Verify configuration
3. Verify TLM connections
4. Verify stimulus
5. Verify observations
6. Verify checking
Debugging rule: Do not debug a scoreboard comparison if you have not first established that the scoreboard exists and is receiving transactions.

Step 10: Build vs connect vs end of elaboration

Phase Main responsibility Typical code
build_phase() Create and configure components type_id::create()
connect_phase() Connect communication interfaces port.connect(export)
end_of_elaboration_phase() Inspect and validate the completed hierarchy print_topology()
run_phase() Perform time-consuming simulation activity sequences, drivers, monitors

A useful mental model is:

BUILD


Create the pieces.

CONNECT
Wire the pieces together.

END OF ELABORATION
Inspect the completed system.

RUN
Start simulation activity.

Step 11: Common mistakes

Mistake 1: Connecting a component that was never created

monitor.ap.connect(scoreboard.analysis_export);

If scoreboard was not created during build, the connection cannot work correctly.

Fix: verify the build hierarchy first.

Mistake 2: Using the wrong port

A monitor might contain:

uvm_analysis_port #(bus_transaction) ap;

Make sure you connect the actual port that publishes the transaction.

Mistake 3: Connecting incompatible transaction types

The communication endpoints must use compatible TLM types.

For example, if the monitor publishes:

uvm_analysis_port #(bus_transaction)

the receiving implementation must be prepared to receive bus_transaction.

Mistake 4: Starting simulation activity in connect_phase()

Connect phase is for wiring components together, not for driving DUT stimulus.

Keep time-consuming activity in run_phase() and sequences.

Mistake 5: Assuming a connection exists because both components exist

Creating a monitor and scoreboard does not automatically connect them.

build:


monitor exists
scoreboard exists

connect:
monitor.ap.connect(scoreboard.analysis_export)

The components can exist perfectly while still having no communication path.

Step 12: A practical debugging workflow

When a scoreboard receives no transactions, debug from the outside toward the inside.

  1. Check the hierarchy. Does the monitor and scoreboard exist?
  2. Check the connection. Is the monitor analysis port connected?
  3. Check the monitor. Is it actually detecting a protocol transaction?
  4. Check the write method. Is the scoreboard receiving the transaction?
  5. Check the scoreboard. Is the comparison logic executing?

This prevents you from immediately changing the scoreboard when the real problem might be that the monitor never published anything.

Debugging mindset: Follow the transaction path from the DUT pins → monitor → TLM connection → scoreboard.

Step 13: The complete lifecycle so far

You can now connect the first three important stages of a UVM environment:

build_phase()
|
| create components
v


connect_phase()
|
| connect TLM interfaces
v
end_of_elaboration_phase()
|
| inspect final topology
v
run_phase()
|
| drive and observe transactions
v
checking

This leads to one of the most useful UVM architectural rules:

Create → Configure → Connect → Run → Check → Report

Each stage has a clear responsibility. Keeping those responsibilities separate makes UVM environments easier to understand, reuse, and debug.

Try it yourself

Build a small UVM environment containing:

uvm_test_top


└── env
├── agent
│   └── monitor
└── scoreboard

Then complete these tasks:

  1. Create the agent and scoreboard in build_phase().
  2. Make the monitor contain an analysis port.
  3. Make the scoreboard able to receive the transaction.
  4. Connect the monitor to the scoreboard in connect_phase().
  5. Print the topology in end_of_elaboration_phase().
  6. Confirm that the final hierarchy matches your design.

Challenge: Add a message inside the scoreboard's write() method. Later, when you learn monitors and drivers, use that message to prove that a transaction successfully traveled through the complete TLM path.

Key takeaways

  • build_phase() creates the UVM component hierarchy.
  • connect_phase() establishes communication between existing components.
  • TLM lets components communicate using transactions rather than direct DUT signal manipulation.
  • A monitor commonly publishes observed transactions through an analysis port.
  • A scoreboard can receive those transactions and perform checking.
  • end_of_elaboration_phase() is useful for inspecting the completed testbench before simulation begins.
  • uvm_root::get().print_topology() is a valuable hierarchy-debugging tool.
  • Connect phase is a function phase; simulation time should not be consumed there.
  • Debug the hierarchy and transaction path before debugging complex checking logic.
  • The growing UVM mental model is: Create → Configure → Connect → Run → Check → Report.