Module 2: TLM and Data Flow | Intermediate UVM

Analysis FIFOs

Learn how to buffer monitored transactions, decouple producers from consumers, and build reliable UVM data paths using analysis FIFOs.

Learning objectives

  • Explain why an analysis FIFO is useful in a UVM verification environment.
  • Distinguish an analysis FIFO from a direct analysis-port connection.
  • Connect a monitor's analysis port to a uvm_tlm_analysis_fifo.
  • Retrieve transactions using blocking and nonblocking FIFO operations.
  • Understand FIFO depth, buffering, ordering, and backpressure implications.
  • Choose an appropriate FIFO architecture for scoreboards and other consumers.
  • Debug empty, overflowing, or incorrectly connected analysis FIFOs.

Step 1: Why do we need an analysis FIFO?

In Lesson 12, we learned that an analysis port allows a monitor to broadcast an observed transaction to multiple consumers.

That works well when the consumer can process the transaction immediately. But sometimes the consumer needs to process transactions independently from the monitor.

For example:

  • the monitor observes packets continuously,
  • the scoreboard performs more expensive processing,
  • the scoreboard needs to retrieve transactions from its own process, and
  • the consumer should not have to perform all processing directly inside write().

An analysis FIFO provides a bridge between these two execution models. The monitor publishes transactions, while the consumer retrieves them from a queue.

Core idea: an analysis FIFO combines the notification semantics of an analysis interface with FIFO storage semantics.

Step 2: Direct analysis versus FIFO-based communication

Consider the two architectures below.

Direct analysis connection




Monitor
|
| write(packet)
v
Scoreboard.write(packet) 

The scoreboard receives the transaction directly through its analysis implementation.

FIFO-based connection




Monitor
|
| write(packet)
v
+----------------------+
| Analysis FIFO        |
|                      |
| packet 17            |
| packet 18            |
| packet 19            |
+----------+-----------+
|
| get(packet)
v
Scoreboard 

The FIFO introduces storage between the producer and consumer.

This is the central difference from Lesson 12:

Direct Analysis Port Analysis FIFO
Publishes immediately to subscribers Stores transactions for later retrieval
No FIFO storage Provides FIFO storage
Consumer implements write() Consumer retrieves transactions with FIFO methods
Excellent for lightweight observers Excellent when producer and consumer need decoupling

Step 3: Understand uvm_tlm_analysis_fifo

UVM provides uvm_tlm_analysis_fifo #(T) specifically for this pattern.

uvm_tlm_analysis_fifo #(packet) packet_fifo;

The parameter packet specifies the transaction type stored in the FIFO.

A typical scoreboard might declare:

class packet_scoreboard extends uvm_component;


uvm_tlm_analysis_fifo #(packet) packet_fifo;

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

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


packet_fifo = new("packet_fifo", this);


endfunction

endclass

The scoreboard now owns a FIFO into which observed transactions can be deposited.

Step 4: Connect the monitor to the FIFO

One of the useful properties of uvm_tlm_analysis_fifo is that it provides an analysis interface on its input side.

This allows the monitor's analysis port to connect directly to the FIFO.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

monitor.analysis_port.connect(scoreboard.packet_fifo.analysis_export);

endfunction

The data path is therefore:




monitor.analysis_port
|
v
packet_fifo.analysis_export
|
v
FIFO storage
|
v
scoreboard.packet_fifo.get() 

The monitor does not need to know that the final consumer is a scoreboard. It only publishes transactions.

Step 5: Retrieve transactions with get()

The consumer can retrieve transactions using the FIFO's blocking get() operation.

task run_phase(uvm_phase phase);


packet pkt;

forever begin


packet_fifo.get(pkt);

`uvm_info("SCOREBOARD",
          $sformatf("Received packet id=%0d", pkt.id),
          UVM_MEDIUM)

// Check packet here


end

endtask

If the FIFO is empty, get() waits until a transaction becomes available.

This is one of the most important advantages of the FIFO: the scoreboard does not have to poll continuously for new transactions.

Think in terms of synchronization: get() means “give me the next transaction, waiting if necessary.”

Step 6: Blocking versus nonblocking retrieval

UVM TLM FIFOs provide both blocking and nonblocking operations.

Blocking get()

packet_fifo.get(pkt);

If the FIFO is empty, the calling process waits.

Nonblocking try_get()

if (packet_fifo.try_get(pkt)) begin


`uvm_info("FIFO", "Transaction received", UVM_MEDIUM)
end
else begin
  `uvm_info("FIFO", "FIFO currently empty", UVM_LOW)
end

try_get() returns immediately. It does not wait for a transaction.

Use blocking retrieval when the consumer naturally waits for the next item. Use nonblocking retrieval when the consumer has other work to perform and cannot simply wait.

Step 7: FIFO depth

A FIFO has a finite capacity unless configured otherwise.

uvm_tlm_analysis_fifo #(packet) packet_fifo;

The default behavior provides buffering, but production environments should still reason explicitly about the expected transaction rate and consumer processing rate.

Imagine that a monitor produces transactions faster than a consumer can process them:




Producer rate:  100 packets/us
Consumer rate:   70 packets/us


    Producer
        |
        v
   +----------+
   |  FIFO    |
   | ######## |
   | ######## |
   | ####     |
   +----+-----+
        |
        v
    Consumer
    

The FIFO temporarily absorbs the difference. It does not make the consumer infinitely fast.

Step 8: Ordering guarantees

An analysis FIFO preserves FIFO ordering for the transactions it stores.




Monitor publishes:

packet 10
packet 11
packet 12

FIFO contains:

10 -> 11 -> 12

Consumer receives:

10
11
12 

This makes analysis FIFOs particularly useful for in-order checking.

However, do not confuse FIFO ordering with protocol response ordering.

A FIFO faithfully preserves the order in which transactions enter it. It does not guarantee that the DUT itself processes requests or produces responses in that same order.

Handling responses that complete out of order is a separate verification problem, which will be addressed later in this learning path.

Step 9: One monitor, multiple FIFOs

Analysis fanout and analysis FIFOs can be combined.


                     +--> scoreboard FIFO
                     |


Monitor analysis_port ---+--> coverage FIFO
|
+--> checker FIFO 

This allows each consumer to have its own queue and processing model.

For example:

  • the scoreboard can process transactions at its own pace,
  • the coverage collector can sample transactions independently, and
  • another checker can maintain a separate transaction stream.

This is a powerful architecture for large environments because each consumer is isolated from the implementation details of the others.

Step 10: Complete practical example

The following example combines the monitor, FIFO, and scoreboard into one simple transaction path.

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

  `uvm_info("MONITOR",
            $sformatf("Observed packet id=%0d", pkt.id),
            UVM_MEDIUM)

  analysis_port.write(pkt);

end


endtask

endclass

class packet_scoreboard extends uvm_component;

uvm_tlm_analysis_fifo #(packet) packet_fifo;

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

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


packet_fifo = new("packet_fifo", this);


endfunction

task run_phase(uvm_phase phase);


packet pkt;

forever begin

  packet_fifo.get(pkt);

  `uvm_info("SCOREBOARD",
            $sformatf("Checking packet id=%0d", pkt.id),
            UVM_MEDIUM)

  // Reference-model comparison would occur here.

end


endtask

endclass

class packet_env extends uvm_env;

packet_monitor    monitor;
packet_scoreboard scoreboard;

function void build_phase(uvm_phase phase);


super.build_phase(phase);

monitor    = packet_monitor::type_id::create("monitor", this);
scoreboard = packet_scoreboard::type_id::create("scoreboard", this);


endfunction

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

monitor.analysis_port.connect(
  scoreboard.packet_fifo.analysis_export
);


endfunction

endclass

Trace the transaction carefully:

  1. The monitor observes a packet.
  2. The monitor publishes it through analysis_port.write().
  3. The FIFO receives and stores the transaction.
  4. The scoreboard waits on packet_fifo.get().
  5. The scoreboard retrieves the transaction.
  6. The scoreboard performs its checking.

Step 11: Why use a FIFO instead of doing work in write()?

A common beginner design is to perform all scoreboard processing directly inside an analysis write() method.

function void write(packet pkt);


// Large amount of scoreboard processing

endfunction

That can become difficult to maintain as the scoreboard becomes more sophisticated.

With a FIFO, the analysis callback primarily deposits the transaction, while a separate process retrieves and processes it.




Analysis notification
|
v
FIFO
|
v
Scoreboard process
|
v
Reference model / checking 

This creates a useful separation between transaction arrival and transaction processing.

Step 12: A critical distinction — buffering is not backpressure

An analysis FIFO should not automatically be interpreted as a backpressure mechanism.

The monitor is publishing observations. The DUT's protocol may have completely different flow-control semantics.

For example, if the DUT uses ready/valid, FIFO occupancy in the verification environment does not automatically control the DUT's ready signal.

Step 13: Debugging an empty FIFO

Suppose the scoreboard is waiting forever:

packet_fifo.get(pkt);

Work backward through the transaction path.

  1. Is the monitor observing transactions?
  2. Does the monitor call analysis_port.write()?
  3. Was the FIFO constructed?
  4. Was the monitor connected to packet_fifo.analysis_export?
  5. Was the connection made during connect_phase?
  6. Are the transaction types compatible?
  7. Is the scoreboard process actually running?

A useful technique is to instrument both sides:

`uvm_info("MONITOR",
      $sformatf("Publishing packet id=%0d", pkt.id),
      UVM_MEDIUM)


packet_fifo.get(pkt);

`uvm_info("SCOREBOARD",
$sformatf("Retrieved packet id=%0d", pkt.id),
UVM_MEDIUM)

If the first message appears but the second does not, investigate the connection and FIFO path before changing the scoreboard algorithm.

Step 14: Common mistakes

Mistake 1 — Confusing an analysis FIFO with an analysis port. An analysis port publishes transactions; an analysis FIFO also stores them.
Mistake 2 — Forgetting the connection. Constructing a FIFO does not connect it automatically to the monitor.
Mistake 3 — Calling get() from a function. Blocking FIFO operations belong in a task-based process because they may wait.
Mistake 4 — Assuming a FIFO fixes throughput problems. It absorbs temporary bursts but cannot compensate indefinitely for a slower consumer.
Mistake 5 — Treating FIFO order as DUT response order. FIFO ordering describes the order of stored transactions, not necessarily the order in which the DUT completes operations.
Mistake 6 — Using one FIFO when every consumer needs every transaction. Multiple consumers sharing one FIFO do not automatically each receive every item. Use analysis fanout to provide independent streams when broadcast semantics are required.

Practice: Monitor → Analysis FIFO → Scoreboard

Build a small UVM environment containing:

  1. one monitor,
  2. one uvm_tlm_analysis_fifo #(packet), and
  3. one scoreboard.

Generate ten packets with sequential IDs:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

The monitor should publish every packet. The scoreboard should retrieve and print every packet ID.

Your output should demonstrate:




MONITOR    : Publishing packet 0
SCOREBOARD : Retrieved packet 0

MONITOR    : Publishing packet 1
SCOREBOARD : Retrieved packet 1

...

MONITOR    : Publishing packet 9
SCOREBOARD : Retrieved packet 9 

Extension challenge

Modify the scoreboard so that it intentionally takes longer to process each transaction. Observe how the FIFO temporarily accumulates transactions.

Then compare this architecture with a direct analysis subscriber from Lesson 12. Explain which design gives the scoreboard better processing decoupling and why.

Debugging challenge

Your simulation produces:

MONITOR: Publishing packet id=42

but the scoreboard never prints:

SCOREBOARD: Retrieved packet id=42

The scoreboard is blocked at:

packet_fifo.get(pkt);

Find the most likely architectural problem before changing the scoreboard code.

Reveal the reasoning

Because the monitor reports that it published the transaction, the monitor's observation path is probably functioning.

The next place to inspect is the TLM connection:

monitor.analysis_port.connect(


scoreboard.packet_fifo.analysis_export
);

Verify that this connection exists, that it is executed in connect_phase, and that the FIFO was constructed.

Knowledge check

  1. What problem does an analysis FIFO solve that a direct analysis connection does not?
  2. Why can get() block?
  3. When would try_get() be useful?
  4. Does a FIFO guarantee that the DUT processes transactions in FIFO order?
  5. Can multiple consumers share one FIFO and still automatically receive every transaction?
  6. What is the difference between TLM buffering and DUT protocol backpressure?
Answers
  1. It provides storage and decouples transaction publication from transaction processing.
  2. get() waits when the FIFO contains no available transaction.
  3. try_get() is useful when the consumer must continue executing rather than wait for a transaction.
  4. No. It guarantees FIFO ordering of transactions stored in that FIFO, not DUT processing or response ordering.
  5. No. A shared FIFO is a queue, not a broadcast mechanism. Consumers would compete for transactions. Use analysis fanout when every consumer needs the complete stream.
  6. TLM buffering stores verification transactions. Protocol backpressure is a functional mechanism in the DUT/interface that controls whether transfers occur.

Key takeaways

  • An analysis FIFO adds storage and processing decoupling to an analysis data path.
  • Connect a monitor's analysis port to the FIFO's analysis interface, then retrieve transactions from the FIFO.
  • Use get() when waiting for the next transaction is appropriate and try_get() when the consumer needs nonblocking behavior.
  • FIFOs preserve the order in which transactions enter the queue.
  • A FIFO absorbs temporary bursts but does not solve a permanent throughput mismatch.
  • A FIFO is not automatically a protocol backpressure mechanism.
  • If every consumer needs every transaction, use analysis fanout and give each consumer its own path or FIFO.
  • Analysis FIFOs are especially useful when a scoreboard, predictor, or checker needs to process transactions independently from the monitor's publication path.