Analysis Port Fanout
Learn how one UVM monitor broadcasts observed transactions to multiple independent consumers such as scoreboards, coverage collectors, protocol checkers, and transaction loggers.
Learning objectives
- Explain the purpose and semantics of a UVM analysis port.
- Understand one-to-many transaction fanout and why it is useful in reusable environments.
- Distinguish
uvm_analysis_port,uvm_analysis_export, anduvm_analysis_imp. - Connect one monitor to multiple consumers using analysis TLM.
- Understand the ordering and execution implications of analysis callbacks.
- Avoid common transaction-sharing and connectivity mistakes.
- Debug analysis-port connectivity using UVM topology and reports.
Step 1: Why analysis fanout matters
A monitor observes activity on an interface and converts that activity into a transaction. Once the transaction exists, several verification components may need to see it.
For example, the same observed packet may be required by:
- a scoreboard to determine whether the DUT behaved correctly,
- a coverage collector to measure functional coverage,
- a protocol checker to detect illegal behavior,
- a transaction logger for debug, and
- a predictor or reference model.
It would be poor architecture for the monitor to know about every one of these components. Instead, the monitor publishes transactions through an analysis port.
The environment then connects as many subscribers as necessary. This is analysis port fanout.
Step 2: Visualize the data flow
+------------------+
| Monitor |
| |
| analysis_port |
+--------+---------+
|
+-----------+-----------+
| | |
v v v
+-----------+ +-----------+ +-----------+
| Scoreboard| | Coverage | | Protocol |
| | | Collector | | Checker |
+-----------+ +-----------+ +-----------+
One observed transaction
|
+----> Consumer A
|
+----> Consumer B
|
+----> Consumer C
The important architectural property is that the monitor does not need references to the scoreboard, coverage collector, or checker.
This makes the monitor reusable. A different environment can connect a different set of subscribers without modifying the monitor implementation.
Step 3: Understand the analysis port contract
The standard UVM analysis mechanism is based on
uvm_analysis_port #(T).
uvm_analysis_port #(packet) analysis_port;
A monitor typically constructs the port and publishes transactions through
write().
class packet_monitor extends uvm_monitor;
uvm_analysis_port #(packet) analysis_port;
function new(string name, uvm_component parent);
super.new(name, parent);
analysis_port = new("analysis_port", this);
endfunction
task run_phase(uvm_phase phase);
packet pkt;
forever begin
pkt = collect_packet();
analysis_port.write(pkt);
end
endtask
endclass
The monitor owns the analysis port. The monitor is the producer.
Components connected to that port become consumers.
Step 4: A consumer uses an analysis implementation
A simple consumer can implement the analysis interface using
uvm_analysis_imp.
class packet_checker extends uvm_component;
uvm_analysis_imp #(packet, packet_checker) analysis_imp;
function new(string name, uvm_component parent);
super.new(name, parent);
analysis_imp = new("analysis_imp", this);
endfunction
function void write(packet pkt);
`uvm_info("CHECKER",
$sformatf("Received packet: %s", pkt.sprint()),
UVM_MEDIUM)
endfunction
endclass
The key method is write().
When a transaction reaches this analysis implementation, UVM invokes the consumer's
write() method.
write(); it does not wait for a response from the consumer.
Step 5: Create real fanout
Now create two independent consumers: a scoreboard and a coverage collector.
class packet_scoreboard extends uvm_component;
uvm_analysis_imp #(packet, packet_scoreboard) analysis_imp;
function new(string name, uvm_component parent);
super.new(name, parent);
analysis_imp = new("analysis_imp", this);
endfunction
function void write(packet pkt);
`uvm_info("SCOREBOARD",
"Scoreboard received transaction",
UVM_MEDIUM)
endfunction
endclass
class packet_coverage extends uvm_component;
uvm_analysis_imp #(packet, packet_coverage) analysis_imp;
function new(string name, uvm_component parent);
super.new(name, parent);
analysis_imp = new("analysis_imp", this);
endfunction
function void write(packet pkt);
`uvm_info("COVERAGE",
"Coverage collector received transaction",
UVM_MEDIUM)
endfunction
endclass
The environment can connect both consumers to the same monitor.
function void connect_phase(uvm_phase phase);
monitor.analysis_port.connect(scoreboard.analysis_imp);
monitor.analysis_port.connect(coverage.analysis_imp);
endfunction
The result is true fanout:
monitor
|
| write(pkt)
|
+----> scoreboard.write(pkt)
|
+----> coverage.write(pkt)
The monitor does not contain any scoreboard-specific or coverage-specific code. That separation is one of the most important reasons analysis ports are so useful in reusable verification environments.
Step 6: What actually happens during write()?
When the monitor executes:
analysis_port.write(pkt);
UVM propagates the transaction to the connected analysis interfaces.
Each connected subscriber receives a write(pkt) call.
Conceptually:
analysis_port.write(pkt)
|
+--------------+--------------+
| | |
v v v
scoreboard.write coverage.write checker.write
This is fundamentally different from a queue where a transaction is consumed by one reader. With analysis fanout, the same publication can reach multiple consumers.
Step 7: Analysis ports are not FIFOs
This distinction is critical and is frequently misunderstood by engineers learning UVM TLM.
| Analysis Port | Analysis FIFO |
|---|---|
| Broadcast-oriented | Storage-oriented |
| Consumers receive notifications | Consumers retrieve transactions |
Typically uses write() |
Uses FIFO operations such as get() |
| No transaction queueing by the analysis port itself | Transactions are buffered |
| Excellent for scoreboards, coverage, and monitors | Useful when consumers need decoupling or buffering |
Therefore, do not confuse:
analysis_port.write(pkt);
with:
analysis_fifo.get(pkt);
The FIFO example belongs to the next lesson, where we will study analysis FIFOs and transaction buffering.
Step 8: Ordering and execution semantics
Fanout does not mean that consumers execute in parallel.
The analysis callbacks are invoked as part of the producer's
write() operation.
Therefore, a poorly designed subscriber can affect the producer's progress.
For example, avoid performing expensive or blocking work directly inside an
analysis write() implementation.
// Avoid this style in a simple analysis callback
function void write(packet pkt);
// Long computation
// Blocking synchronization
// Waiting for unrelated events
endfunction
Prefer lightweight notification and move complex processing into an appropriate process or use a TLM FIFO when buffering and decoupling are required.
Step 9: A subtle transaction-sharing issue
Analysis fanout commonly delivers a handle to the same transaction object to multiple consumers.
analysis_port.write(pkt);
Therefore, subscribers should normally treat received transactions as read-only observations.
A dangerous pattern is:
function void write(packet pkt);
// Dangerous if other subscribers use the same object
pkt.data = 0;
endfunction
One subscriber modifying the transaction can unintentionally change what another subscriber observes.
If a consumer needs to modify a transaction for its own processing, make an explicit copy.
packet local_pkt;
local_pkt = packet'(pkt.clone());
Whether copying is required depends on the transaction design, but the architectural rule is simple: do not unexpectedly mutate transactions received through an analysis connection.
Step 10: Using an analysis export for reusable layering
In larger environments, the producer and final consumer are not always direct neighbors.
An uvm_analysis_export allows an intermediate component to expose
an analysis interface and forward it to another component.
monitor
|
v
agent analysis port
|
v
environment analysis export
|
+----> scoreboard
|
+----> coverage
This becomes useful when building reusable agents whose internal implementation should remain hidden from the environment.
Think of the three concepts this way:
- analysis port: publishes transactions.
- analysis export: forwards/exposes an analysis interface.
- analysis implementation: receives the transaction and executes
write().
Step 11: Connectivity belongs in connect_phase
Analysis connections should normally be established during
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_imp);
agent.monitor.analysis_port.connect(protocol_checker.analysis_imp);
endfunction
This makes the environment topology explicit and keeps construction separate from connectivity.
A useful debugging habit is to inspect the topology when a subscriber unexpectedly receives no transactions.
uvm_root::get().print_topology();
If the monitor is producing transactions but the scoreboard receives nothing, check the connection before changing the monitor or scoreboard implementation.
Step 12: Production architecture pattern
A reusable protocol agent commonly follows this pattern:
+-----------------------+
| Protocol Agent |
| |
Interface ----------> Driver |
| |
Interface ----------> Monitor |
| | |
+------+----------------+
|
analysis_port
|
+-------------+-------------+
| | |
v v v
Scoreboard Coverage Protocol
Collector Checker
Notice that the monitor has one job: observe protocol activity and publish transactions.
The consumers decide how those transactions are used. This separation dramatically improves reuse.
Step 13: Debugging checklist
When an analysis subscriber receives nothing, work through the problem in this order:
- Is the monitor actually observing a valid transaction?
- Does the monitor call
analysis_port.write()? - Was the analysis port constructed?
- Was the consumer's analysis implementation constructed?
- Is the connection made in
connect_phase? - Are the producer and consumer transaction types compatible?
- Does the consumer implement the expected
write()method? - Does the simulation reach the phase in which transactions are generated?
- Could the consumer be filtering or ignoring the transaction?
Do not immediately modify the scoreboard when it receives no transactions. First prove where the transaction disappears.
Step 14: Common mistakes
write().
Analysis callbacks are intended for notification. Use buffering or another
synchronization mechanism when processing must be decoupled.
Practice: Build a three-way analysis fanout
Create a small UVM environment containing one monitor and three consumers:
- a scoreboard,
- a coverage collector, and
- a protocol checker.
Connect all three to the monitor's analysis port. Generate at least five transactions.
Each consumer must report the transaction ID it receives.
Your expected observation should demonstrate that every published transaction reaches all three consumers.
Extension challenge
Add a fourth consumer that records the transaction stream. Do not modify the monitor.
If adding the new consumer requires changing the monitor's implementation, your architecture has lost the primary benefit of analysis fanout.
Debugging challenge
Suppose the monitor reports:
MONITOR: observed packet id=17
but the scoreboard reports nothing. The coverage collector receives the packet correctly.
Determine which part of the environment you should inspect first.
Think before opening the answer
The monitor is producing the transaction because the coverage collector receives it. Therefore, do not start by debugging interface sampling.
First inspect the scoreboard connection in connect_phase,
then verify that its analysis implementation exists and that its
write() method is correctly implemented.
Knowledge check
- Why is an analysis port a good fit for a monitor?
- What is the difference between fanout and FIFO-based communication?
- Why should analysis subscribers normally avoid modifying received transactions?
-
What role does
uvm_analysis_impplay? - When might an analysis FIFO be preferable to direct analysis fanout?
Answers
- A monitor naturally publishes observations that may be needed by multiple independent verification components.
- Analysis fanout broadcasts a transaction to multiple consumers, while a FIFO provides buffering and retrieval semantics.
- Multiple consumers may observe the same transaction object, so mutation by one consumer can affect another consumer.
-
uvm_analysis_impprovides the consumer-side implementation of the analysis interface, typically through awrite()method. - Use an analysis FIFO when the consumer needs buffering, independent processing, or decoupling from the producer's execution.
Key takeaways
- Analysis ports implement broadcast-style transaction delivery.
- One monitor can publish the same observation to a scoreboard, coverage collector, checker, predictor, and other subscribers.
- Keep monitors focused on observation and transaction publication rather than embedding checking logic inside them.
- Treat analysis transactions as observations; avoid unexpected mutation.
-
Use
uvm_analysis_portfor publishing,uvm_analysis_exportfor forwarding/exposing an analysis interface, anduvm_analysis_impfor implementing the receivingwrite()operation. - Analysis ports do not provide FIFO-style buffering. When buffering or decoupling is required, an analysis FIFO may be the better architecture.
- In production environments, analysis fanout is one of the mechanisms that allows verification components to remain loosely coupled and reusable.