TLM Debugging
Learn a systematic method for tracing transactions through UVM TLM connections, diagnosing missing, duplicated, reordered, or corrupted transactions, and turning TLM failures into actionable debug evidence.
Learning objectives
- Trace a transaction through a UVM TLM data path.
- Distinguish construction, connection, synchronization, and transaction-data failures.
- Use targeted UVM reporting to locate where a transaction disappears or changes.
- Debug analysis ports, FIFOs, subscribers, and scoreboard consumers.
- Recognize common TLM connectivity and transaction ownership mistakes.
- Build a repeatable debugging strategy instead of relying on random code changes.
- Use transaction IDs and timestamps to correlate activity across components.
Step 1: Think of TLM as a transaction pipeline
TLM debugging becomes much easier when you stop thinking of a connection as "some UVM port wiring" and instead treat it as a transaction pipeline.
TLM DATA PATH
Producer
|
| write(pkt)
v
Analysis Port
|
v
TLM Connection
|
+-------------------+
| |
v v
Analysis FIFO Subscriber
|
v
Scoreboard
|
v
Check
A transaction can fail at any point in this path.
When the scoreboard does not receive an expected transaction, do not immediately modify the scoreboard. First determine which stage stopped behaving as expected.
Step 2: Define the expected transaction flow
Before debugging, write down the intended path.
For example:
DUT interface
|
v
monitor
|
v
analysis_port
|
v
analysis_fifo
|
v
scoreboard
|
v
reference comparison
For each boundary, identify:
- Who produces the transaction?
- Who consumes it?
- What TLM interface connects them?
- Is the communication blocking or nonblocking?
- Can the transaction be buffered?
- Is the transaction copied or shared?
This turns a vague failure such as "the scoreboard is missing packets" into a sequence of specific questions.
Step 3: Start with a transaction identity
Debugging becomes significantly easier when every important transaction can be uniquely identified.
A useful transaction may contain:
class packet extends uvm_sequence_item;
rand bit [31:0] addr;
rand bit [31:0] data;
int unsigned transaction_id;
`uvm_object_utils(packet)
function new(string name = "packet");
super.new(name);
endfunction
endclass
The transaction ID lets you answer questions such as:
- Was transaction 17 created?
- Did transaction 17 reach the monitor?
- Did transaction 17 enter the FIFO?
- Did transaction 17 reach the scoreboard?
- Was transaction 17 compared?
This is much more useful than debugging a stream of identical messages saying
only "packet received".
Step 4: Instrument the producer
Start at the earliest point where the transaction is known to exist.
function void publish_packet(packet pkt);
`uvm_info("TLM_TX",
$sformatf("Publishing packet id=%0d addr=%08h data=%08h",
pkt.transaction_id,
pkt.addr,
pkt.data),
UVM_MEDIUM)
analysis_port.write(pkt);
endfunction
Now you have evidence that the producer attempted to publish the transaction.
If this message never appears, debugging the FIFO or scoreboard is premature. The problem is upstream.
Step 5: Verify the connection
A producer can be working perfectly while the consumer receives nothing because the TLM connection is missing or incorrect.
A typical connection may look like:
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
monitor.analysis_port.connect(scoreboard.analysis_export);
endfunction
For an analysis FIFO:
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
monitor.analysis_port.connect(request_fifo.analysis_export);
scoreboard.request_fifo.connect(request_fifo.blocking_get_export);
endfunction
The exact architecture may differ, but the debugging question remains the same: is every required TLM endpoint connected to the intended destination?
Step 6: Use connection-time checks
TLM problems are much easier to diagnose when invalid configuration is detected during elaboration rather than several microseconds into simulation.
UVM's connection mechanism performs interface checks, but you should still design your environment so that the topology is easy to inspect.
Use:
uvm_top.print_topology();
to inspect the component hierarchy.
Remember that the component topology tells you what was constructed. It does not by itself prove that every intended TLM connection is correct.
Step 7: Trace the transaction at every boundary
Add temporary, targeted instrumentation at important boundaries.
// Monitor
`uvm_info("TRACE",
$sformatf("MONITOR id=%0d", pkt.transaction_id),
UVM_HIGH)
// FIFO consumer
`uvm_info("TRACE",
$sformatf("FIFO_GET id=%0d", pkt.transaction_id),
UVM_HIGH)
// Scoreboard
`uvm_info("TRACE",
$sformatf("SCOREBOARD id=%0d", pkt.transaction_id),
UVM_HIGH)
// Predictor
`uvm_info("TRACE",
$sformatf("PREDICTOR id=%0d", pkt.transaction_id),
UVM_HIGH)
You are trying to establish a sequence such as:
MONITOR id=21
FIFO_GET id=21
SCOREBOARD id=21
PREDICTOR id=21
COMPARE id=21
If the trace stops here:
MONITOR id=21
FIFO_GET id=21
then the problem is probably downstream of the FIFO consumer and before the scoreboard processing.
Step 8: Debug a missing transaction
Suppose the scoreboard expects transaction 42 but never sees it.
Use this decision tree:
Was transaction 42 generated?
|
no +----> Debug stimulus
|
yes
|
Did the monitor observe it?
|
no +----> Debug monitor/interface sampling
|
yes
|
Did the monitor publish it?
|
no +----> Debug monitor transaction flow
|
yes
|
Did the connected consumer receive it?
|
no +----> Debug TLM connection/FIFO
|
yes
|
Did the scoreboard process it?
|
no +----> Debug scoreboard control flow
|
yes
|
Was it compared correctly?
|
no +----> Debug checker/reference model
|
yes
|
PASS
This is much faster than changing several components and rerunning the entire test.
Step 9: Debug a duplicated transaction
Missing transactions are not the only TLM failure. A transaction can also appear more than once.
For example, the same transaction may accidentally be published twice:
analysis_port.write(pkt);
analysis_port.write(pkt); // unintended duplicate
Another possibility is that two producers are legitimately connected to the same consumer.
When debugging duplication, record:
- transaction ID,
- producer name,
- simulation time,
- destination component, and
- number of times the transaction was observed.
The goal is to determine whether the duplication occurred at publication, connection, buffering, or consumption.
Step 10: Debug transaction mutation
A particularly subtle UVM bug occurs when a producer reuses or modifies a transaction object after publishing it.
Consider:
packet pkt;
forever begin
pkt = packet::type_id::create("pkt");
// Populate pkt
analysis_port.write(pkt);
// Later modify or reuse pkt
end
Analysis communication passes an object handle. If multiple components retain that handle and the producer later modifies the object, consumers may observe data different from what the producer originally intended to publish.
A common defensive technique is to publish a copy when the architecture requires transaction independence:
packet pkt_copy;
$cast(pkt_copy, pkt.clone());
analysis_port.write(pkt_copy);
Whether cloning is appropriate depends on the transaction ownership model. Do not blindly clone every transaction; instead, define who owns and may modify each object.
Step 11: Debug blocking TLM stalls
From Lesson 14, you know that a blocking operation can wait.
request_fifo.get(pkt);
If execution appears to stop here, determine whether the consumer is correctly waiting for an event or whether the expected producer transaction never arrived.
Instrument both sides:
`uvm_info("SB",
"Waiting for request",
UVM_MEDIUM)
request_fifo.get(pkt);
`uvm_info("SB",
$sformatf("Received request id=%0d", pkt.transaction_id),
UVM_MEDIUM)
If the first message appears forever, investigate upstream transaction production and connectivity before changing the blocking operation.
Step 12: Debug nonblocking TLM
Nonblocking operations introduce a different failure mode: the consumer may simply discover that no transaction is currently available.
if (request_fifo.try_get(pkt)) begin
process_request(pkt);
end
else begin
`uvm_info("SB",
"No request available",
UVM_HIGH)
end
Do not interpret every try_get() failure as a TLM error.
It may simply mean that the producer has not generated the transaction yet.
The debugging question is: Was the transaction expected to be available at this exact point in time?
Step 13: Use timestamps for correlation
Two transactions with the same contents can still represent different events. Simulation time helps correlate activity.
`uvm_info("TRACE",
$sformatf("time=%0t id=%0d addr=%08h",
$time,
pkt.transaction_id,
pkt.addr),
UVM_HIGH)
A useful trace may look like:
time=100 MONITOR id=10
time=100 PUBLISH id=10
time=100 FIFO_GET id=10
time=105 SCOREBOARD id=10
time=105 COMPARE id=10
This can reveal unexpected delays, missing stages, and ordering problems.
Step 14: Debugging analysis fanout
Analysis ports can broadcast one transaction to multiple consumers.
+--> Coverage
|
Monitor --> analysis_port +--> Scoreboard
|
+--> Logger
If the scoreboard receives a transaction but coverage does not, the producer may still be correct.
Debug each destination independently.
Do not assume that because one subscriber receives the transaction, every intended subscriber is correctly connected.
Step 15: Debug FIFO behavior
An analysis FIFO introduces buffering between producer and consumer.
Producer
|
v
Analysis FIFO
|
v
Consumer
This is useful because producer and consumer do not have to execute at exactly the same moment.
During debugging, distinguish between:
- FIFO empty: consumer has no transaction to retrieve.
- FIFO contains data: producer has already delivered transactions.
- Consumer is not draining: transactions may accumulate.
- Unexpected ordering: investigate multiple producers or separate queues.
The FIFO is therefore both a communication mechanism and a useful debugging boundary.
Step 16: Detect consumer starvation
A consumer may technically be connected but still fail to process transactions because its control flow is blocked elsewhere.
For example:
task run_phase(uvm_phase phase);
forever begin
do_expensive_operation();
request_fifo.get(pkt);
process(pkt);
end
endtask
If do_expensive_operation() takes a long time, transactions can
accumulate in the FIFO before the consumer gets to them.
During debug, therefore, ask not only: "Is it connected?" but also: "Is the consumer actually reaching the receive operation?"
Step 17: Debug ordering problems
Suppose the scoreboard receives:
id=11
id=13
id=12
Do not immediately blame the FIFO.
First determine whether:
- multiple producers are publishing concurrently,
- different FIFOs are being merged,
- transactions are being generated concurrently, or
- the scoreboard itself is processing them out of order.
A single FIFO normally preserves the order in which transactions enter that FIFO. If ordering is important to the protocol, document the ordering contract explicitly.
Step 18: Use UVM verbosity strategically
More messages do not automatically mean better debugging. Excessive logging can hide the important event.
A useful strategy is:
UVM_LOW— major lifecycle and high-value events.UVM_MEDIUM— useful transaction-level information.UVM_HIGH— detailed TLM tracing.UVM_FULL/UVM_DEBUG— very detailed diagnostic information when supported by the environment.
Start with a manageable trace and increase verbosity only around the failing path.
Step 19: Build a reusable TLM trace message
Instead of formatting different debug messages throughout the environment, establish a consistent representation.
function void trace_packet(string stage, packet pkt);
`uvm_info(
"TLM_TRACE",
$sformatf(
"stage=%s time=%0t id=%0d addr=%08h data=%08h",
stage,
$time,
pkt.transaction_id,
pkt.addr,
pkt.data
),
UVM_HIGH
)
endfunction
Then:
trace_packet("MONITOR", pkt);
analysis_port.write(pkt);
trace_packet("PUBLISHED", pkt);
Consistent trace fields make logs easier to search and compare across components.
Step 20: A systematic TLM debugging workflow
Use this workflow whenever a TLM path fails:
- Reproduce: reduce the problem to the smallest failing test.
- Identify: assign or locate the transaction ID.
- Trace upstream: prove where the transaction was created and observed.
- Verify publication: confirm that the producer actually called the TLM operation.
- Verify connectivity: inspect the intended port/export/implementation path.
- Verify buffering: determine whether the FIFO contains the transaction.
- Verify consumption: confirm that the consumer retrieves or receives it.
- Verify integrity: compare transaction contents at each important boundary.
- Verify ordering: correlate IDs and timestamps.
- Remove temporary instrumentation: keep only useful reusable diagnostics.
Step 21: Worked example — missing scoreboard transaction
Imagine the monitor reports:
MONITOR id=7
MONITOR id=8
MONITOR id=9
but the scoreboard reports:
SCOREBOARD id=7
SCOREBOARD id=9
Transaction 8 disappeared somewhere between the monitor and scoreboard.
Add tracing:
MONITOR id=8
PUBLISHED id=8
FIFO_GET id=8
SCOREBOARD id=8
If all four messages appear, the original observation was misleading or the scoreboard's later processing discarded the transaction.
If the trace stops at:
MONITOR id=8
PUBLISHED id=8
investigate the TLM connection or FIFO path.
Step 22: What not to do
#100ns delay may make a race disappear without explaining why it occurred.
Try it yourself: Build a TLM trace
Create a small environment containing:
- one monitor,
- one analysis port,
- one analysis FIFO, and
- one scoreboard.
Generate five transactions with IDs 0 through 4. Add trace messages at these stages:
MONITOR
PUBLISHED
FIFO_GET
SCOREBOARD
COMPARE
Verify that every transaction appears at every expected stage.
Then intentionally introduce one TLM connection error and determine where the trace stops.
Challenge: Find the missing transaction
Your log contains:
MONITOR id=100
PUBLISHED id=100
MONITOR id=101
PUBLISHED id=101
FIFO_GET id=100
SCOREBOARD id=100
MONITOR id=102
PUBLISHED id=102
FIFO_GET id=101
SCOREBOARD id=101
The scoreboard has not reported transaction 102.
Answer:
- What is the last stage where transaction 102 is known to exist?
- Which component should you investigate first?
- What additional diagnostic message would you add?
- Would changing
get()totry_get()be your first action?
Reveal the reasoning
Transaction 102 is known to have reached the producer because both
MONITOR and PUBLISHED appear.
There is no FIFO_GET id=102, so the first investigation point
is the path between publication and FIFO consumption.
Useful next checks include:
- Is the analysis port connected to the intended FIFO?
- Is transaction 102 actually present in the FIFO?
- Is the scoreboard blocked or delayed before retrieving it?
- Is another consumer removing transactions from the same FIFO?
Changing get() to try_get() is not the correct
first response. First locate the failing boundary.
Challenge: Detect object mutation
A monitor publishes a transaction and immediately reuses the same object for the next observed item.
The scoreboard sometimes sees the newest transaction's data instead of the data that was present when the transaction was published.
Investigate:
- object handles,
- transaction ownership,
- copying/cloning, and
- when the producer modifies the transaction.
The goal is not simply to add clone().
Explain why the mutation occurs and where ownership should be defined.
Knowledge check
- What is the first question to ask when a scoreboard misses a transaction?
- Why are transaction IDs useful during TLM debugging?
- What does
uvm_top.print_topology()tell you? - Why does a topology print not prove that every TLM connection is correct?
- What is the difference between a missing transaction and a delayed transaction?
- Why can changing
get()totry_get()hide the real problem? - How can object mutation create an apparently corrupted TLM transaction?
- Why should debugging start at the producer and move toward the consumer?
Answers
- Determine the last point where the transaction is known to exist and be correct.
- They allow the same transaction to be correlated across monitors, TLM paths, FIFOs, scoreboards, predictors, and logs.
- It shows the constructed UVM component hierarchy.
- Component construction and TLM connectivity are separate concerns.
- A missing transaction never reaches the expected stage; a delayed transaction may still arrive later.
- It changes synchronization behavior without necessarily fixing the producer, connection, or consumer problem.
- Multiple components may hold the same object handle, so later modifications can change what a consumer observes.
- The producer is the earliest point where transaction existence can be proven, allowing the failing boundary to be narrowed quickly.
Key takeaways
- Treat TLM as a transaction pipeline, not merely as port wiring.
- Debug from the last known-good transaction toward the consumer.
- Transaction IDs and timestamps provide powerful correlation across components.
- Separate construction, connectivity, synchronization, and transaction integrity problems.
-
A blocking
get()can indicate a correctly waiting scoreboard, not necessarily a broken simulation. -
A failed
try_get()does not automatically indicate an error; the transaction may simply not be available yet. - Analysis fanout means that one producer can feed multiple independent consumers, so each destination must be debugged independently.
- TLM debugging should be evidence-driven: instrument the boundaries and locate exactly where the expected behavior stops.
- Transaction object ownership matters. Unexpected mutation can look like a TLM communication failure even when the connection itself is correct.
- The best debugging strategy is usually not "add more delays" or "change the API"; it is to trace one transaction end-to-end.