Module 2: TLM and Data Flow | Intermediate UVM

TLM Ports, Exports, and Imp Ports

Learn how UVM components communicate through transaction-level modeling, how ports, exports, and implementation ports differ, and how to build clean, reusable data-flow paths between monitors, scoreboards, FIFOs, and subscribers.

Learning objectives

  • Explain the purpose of UVM TLM communication.
  • Distinguish between TLM ports, exports, and implementation ports.
  • Identify which component provides and which component consumes a TLM interface.
  • Connect a monitor analysis port to a scoreboard or analysis FIFO.
  • Explain why an uvm_analysis_imp requires an implementation method such as write().
  • Use TLM FIFOs when transactions must be buffered between producers and consumers.
  • Choose an appropriate TLM mechanism based on the required communication semantics.
  • Validate transaction flow with reports, ordering checks, and scoreboard evidence.

Step 1: Understand transaction-level communication

UVM components should communicate primarily through transactions, not by directly manipulating another component's internal state.

A monitor, for example, observes signal-level activity and converts it into a transaction:

interface signals
  |
  v


monitor
|
| transaction
v
scoreboard

The monitor should not need to know how the scoreboard stores, compares, or predicts transactions. It only needs to publish the transaction through an appropriate TLM interface.

This separation is one of the foundations of reusable UVM environments.

Core idea: TLM separates what transaction is communicated from the internal implementation of the component that receives it.

Step 2: The three concepts you must not confuse

The names are similar, but their responsibilities are different.

TLM construct Primary role Think of it as
Port Initiates communication through an interface "I want to use this interface."
Export Forwards/exposes an interface to another component "The interface is available through me."
Imp Provides the actual implementation of the interface "I implement the operation."

A useful mental model is:

PORT  --->  EXPORT  --->  IMP


uses        forwards      implements

Not every TLM connection requires all three objects. The topology depends on how the components are structured.

Step 3: Start with an analysis port

One of the most frequently used TLM mechanisms in UVM is the uvm_analysis_port.

A monitor commonly owns an analysis port:

class bus_monitor extends uvm_monitor;


uvm_analysis_port #(bus_transaction) analysis_port;

function void build_phase(uvm_phase phase);
super.build_phase(phase);
analysis_port = new("analysis_port", this);
endfunction

endclass

The monitor can publish transactions with:

analysis_port.write(tr);

The monitor does not need to know whether the transaction is going to:

  • a scoreboard,
  • a coverage collector,
  • a logger,
  • an analysis FIFO, or
  • multiple subscribers.

That is a major reason analysis ports are so useful.

Step 4: One producer can feed multiple consumers

Analysis communication is naturally useful for broadcasting observations.

                       +--> scoreboard
                   |


monitor --> analysis_port
|
+--> coverage
|
+--> logger

The monitor produces one transaction, while multiple components can independently consume the observation.

This is particularly valuable because adding a new coverage collector should not require modifying the monitor's protocol implementation.

Reuse principle: A monitor should publish what it observed. Consumers decide what that observation means for checking, coverage, or debug.

Step 5: Understand the implementation side

An analysis consumer needs an implementation of the analysis interface. The most common form is uvm_analysis_imp.

class scoreboard extends uvm_scoreboard;


uvm_analysis_imp #(bus_transaction, scoreboard) analysis_imp;

function void build_phase(uvm_phase phase);
super.build_phase(phase);
analysis_imp = new("analysis_imp", this);
endfunction

function void write(bus_transaction tr);
`uvm_info("SB",
$sformatf("Received: %s", tr.sprint()),
UVM_MEDIUM)
endfunction

endclass

The important relationship is:

monitor.analysis_port
    |
    v


scoreboard.analysis_imp
|
v
scoreboard.write(tr)

The imp connects the TLM interface to the receiving component's implementation.

Step 6: Why does write() matter?

When a transaction is sent through an analysis connection, the receiving implementation provides the behavior that handles it.

analysis_port.write(tr);

Conceptually, the transaction reaches the consumer's implementation:

consumer.write(tr);

The scoreboard can then:

  • compare against a reference model,
  • update expected queues,
  • detect protocol errors,
  • collect statistics, or
  • report mismatches.

The key lesson is that uvm_analysis_imp is not itself the checking algorithm. It provides the TLM endpoint through which the component receives transactions.

Step 7: Connect the monitor and scoreboard

The environment typically establishes the connection in connect_phase.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

bus_agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);
endfunction

The complete data path is now:

DUT


|
v
monitor
|
| bus_transaction
v
analysis_port
|
v
analysis_imp
|
v
scoreboard.write()
|
v
comparison/report

Notice the architectural separation:

  • The monitor knows how to observe the protocol.
  • The analysis port publishes the observation.
  • The scoreboard knows how to interpret and check the observation.
  • The environment connects the components.

Step 8: Where does an export fit?

An export becomes useful when the TLM interface needs to be exposed or forwarded through another component.

producer


|
v
child export
|
v
parent export
|
v
implementation

This allows a component hierarchy to expose a communication interface without forcing the producer to know the final consumer.

The export is therefore about connectivity and interface propagation, while the implementation port provides the actual implementation.

Common misconception: An export does not mean "the component performs the operation." An export exposes or forwards an interface; the implementation endpoint performs the operation.

Step 9: Analysis FIFO — when buffering matters

Direct analysis connections are convenient when the consumer can process transactions immediately.

Sometimes the consumer needs buffering.

monitor


|
v
analysis_port
|
v
uvm_tlm_analysis_fifo
|
v
scoreboard

An analysis FIFO allows the producer to publish transactions while the consumer retrieves them later.

For example:

uvm_tlm_analysis_fifo #(bus_transaction) request_fifo;

The consumer can retrieve a transaction using:

bus_transaction tr;


request_fifo.get(tr);

This is useful when the consumer's processing model is naturally sequential or when temporary differences between producer and consumer activity need to be absorbed.

Step 10: Blocking versus analysis communication

Intermediate UVM verification requires understanding that different TLM interfaces have different communication semantics.

Mechanism Typical use
Analysis port Publish observations to one or more consumers
Analysis FIFO Publish observations while buffering them for later consumption
Blocking TLM interface Communication where the caller may wait for the operation
Non-blocking TLM interface Communication where the operation must not require blocking

Do not select a TLM interface simply because it is familiar. Select it based on the communication semantics required by the verification component.

Step 11: Analysis ports are for observation, not command/control

A common architectural mistake is using an analysis connection as if it were a command interface.

An analysis port is well suited to:

monitor --> scoreboard


monitor --> coverage
monitor --> logger

It is not the natural abstraction for:

scoreboard --> driver


test --> driver
monitor --> DUT control

Those relationships involve different responsibilities and should normally use appropriate sequence, sequencer, driver, TLM, or configuration mechanisms.

Step 12: TLM communication should use transactions with clear ownership

A transaction should have a clear meaning and a well-defined lifecycle.

For example:

class bus_transaction extends uvm_sequence_item;


rand bit [31:0] addr;
rand bit [31:0] data;
rand bit         write;

`uvm_object_utils(bus_transaction)

endclass

Consumers should not depend on hidden state inside the monitor. They should receive the transaction data required for their task.

Design question: If a new scoreboard is added tomorrow, can it understand the transaction using only the published transaction object?

Step 13: Avoid tightly coupling the monitor to consumers

This is poor architecture:

monitor.scoreboard.check_transaction(tr);

The monitor now knows that a scoreboard exists and knows its API.

Prefer:

monitor.analysis_port.write(tr);

Now the environment decides what receives the transaction.

                         +--> scoreboard
                     |


monitor --> analysis_port
|
+--> coverage
|
+--> logger

This makes the monitor reusable across tests and environments.

Step 14: Connecting multiple consumers

A realistic environment may connect the same monitor to several analysis components:

function void connect_phase(uvm_phase phase);


bus_agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);

bus_agent.monitor.analysis_port.connect(
coverage.analysis_export
);

bus_agent.monitor.analysis_port.connect(
logger.analysis_export
);

endfunction

The important architectural property is that the monitor does not change when a new consumer is added.

Only the environment's connection topology changes.

Step 15: Debug the TLM path systematically

When a scoreboard reports that no transactions arrived, do not immediately blame the scoreboard.

Trace the complete path:

DUT activity
|
v


Monitor detected transaction?
|
v
Monitor called analysis_port.write()?
|
v
Port connected correctly?
|
v
Export/imp/FIFO connected?
|
v
Consumer received transaction?
|
v
Scoreboard processed transaction?

Add temporary reports at important boundaries:

`uvm_info("MON",
      "Publishing transaction",
      UVM_MEDIUM)


`uvm_info("SB",
"Received transaction",
UVM_MEDIUM)

This allows you to determine where the transaction disappears.

Step 16: A complete monitor-to-scoreboard example

A compact architecture can look like this:

class bus_monitor extends uvm_monitor;


uvm_analysis_port #(bus_transaction) analysis_port;

function void build_phase(uvm_phase phase);
super.build_phase(phase);
analysis_port = new("analysis_port", this);
endfunction

task run_phase(uvm_phase phase);


bus_transaction tr;

forever begin
  tr = bus_transaction::type_id::create("tr");

  // Collect protocol activity here.

  analysis_port.write(tr);

  `uvm_info("MON",
            "Transaction published",
            UVM_HIGH)
end


endtask

endclass

class bus_scoreboard extends uvm_scoreboard;

uvm_analysis_imp #(bus_transaction, bus_scoreboard) analysis_imp;

function void build_phase(uvm_phase phase);
super.build_phase(phase);
analysis_imp = new("analysis_imp", this);
endfunction

function void write(bus_transaction tr);


`uvm_info("SB",
          $sformatf("Received transaction:\n%s",
                    tr.sprint()),
          UVM_MEDIUM)

// Compare against expected behavior here.


endfunction

endclass

And the environment connects them:

function void connect_phase(uvm_phase phase);


agent.monitor.analysis_port.connect(
scoreboard.analysis_imp
);

endfunction

This is the essential UVM data-flow pattern:

Driver --> DUT --> Monitor
                   |
                   v
            Analysis Port
                   |
                   v
            Scoreboard Imp
                   |
                   v
               write()
                   |
                   v
               Checking

Step 17: Choosing the right topology

Use this decision process when designing a TLM connection.

  1. Is the component publishing an observation? Consider an analysis port.
  2. Can the consumer process the transaction immediately? A direct analysis implementation may be appropriate.
  3. Does the consumer need buffering? Consider an analysis FIFO.
  4. Must the interface be forwarded through a hierarchy? Consider an export.
  5. Does the receiving component implement the interface? An implementation port is the endpoint to examine.
  6. Is the communication command/control rather than observation? Consider sequences, sequencers, drivers, or another appropriate TLM interface.

Step 18: Common mistakes

Mistake 1: Confusing a port with an implementation.

A port requests access to an interface; the implementation provides the behavior.
Mistake 2: Assuming an export performs the operation.

An export forwards or exposes an interface. It is not automatically the endpoint that implements the behavior.
Mistake 3: Forgetting the connect_phase connection.

Declaring ports and exports does not automatically create the desired topology.
Mistake 4: Calling write() directly on the scoreboard from the monitor.

This couples the monitor to the scoreboard and defeats the purpose of TLM abstraction.
Mistake 5: Using a FIFO without understanding the consumer model.

Buffering changes how the producer and consumer interact. Make sure that is actually required by the scenario.

Step 19: Verification evidence

A successful TLM connection should be observable.

For this lesson, useful evidence includes:

  • the monitor reporting that it published a transaction,
  • the scoreboard reporting that it received the transaction,
  • matching transaction IDs or addresses,
  • preserved ordering where ordering matters,
  • expected-versus-actual comparison results, and
  • coverage confirming that the intended transaction types arrived.

Do not consider a connection verified merely because the code compiles. Demonstrate that a transaction actually traverses the intended TLM path.

Step 20: Build it incrementally

  1. Create the transaction class.
  2. Create the monitor analysis port.
  3. Publish one deterministic transaction.
  4. Create the receiving component and its implementation endpoint.
  5. Connect the two components in connect_phase.
  6. Run the simulation and prove that the receiver gets the transaction.
  7. Add multiple consumers.
  8. Add an analysis FIFO when buffering is actually required.
  9. Only then introduce randomized traffic and more complex checking.

This sequence isolates topology errors from transaction-generation errors and scoreboard errors.

Step 21: Expert mental model

              TRANSACTION
               |
               v
           Producer
               |
               v
             PORT
               |
        +------+------+
        |             |
        v             v
     EXPORT       ANALYSIS
        |           CONSUMER
        v             |
      EXPORT          v
        |           IMP
        v             |
       IMP <----------+
        |
        v
   Implementation

The exact topology can vary, but always ask the same questions:

  1. Who produces the transaction?
  2. Who consumes it?
  3. Who owns the interface?
  4. Does the interface need to be forwarded?
  5. Does the consumer need buffering?
  6. Where is the actual implementation?
  7. How will the testbench prove that the transaction arrived?

Try it yourself

Build a small UVM environment containing:

  • a bus_transaction,
  • a monitor with an uvm_analysis_port,
  • a scoreboard with an uvm_analysis_imp,
  • an analysis FIFO, and
  • a second consumer for transaction logging or coverage.

Your environment should demonstrate the following flow:

                 +--> scoreboard
             |


monitor ---------+--> analysis FIFO --> FIFO consumer
|
+--> coverage/logger

Then answer these questions:

  1. Why is the monitor using an analysis port?
  2. Why does the scoreboard need an implementation endpoint?
  3. What role does the FIFO play?
  4. Which component owns the transaction?
  5. Where are the connections established?
  6. Can you add another consumer without modifying the monitor?
  7. What evidence proves that every expected transaction arrived?
  8. How would you debug a transaction that appears in the monitor but not in the scoreboard?
Challenge: Add transaction IDs and make the scoreboard report the ID, address, and operation type when a transaction arrives. Then intentionally break one TLM connection and use the simulation messages to locate the broken link.

Verification checkpoint

You have mastered this lesson when you can look at a UVM TLM topology and explain the complete path without relying on memorized definitions.

  • Where is the transaction created?
  • Where is it published?
  • Which port initiates the communication?
  • Is an export needed to forward the interface?
  • Where is the implementation?
  • Does the consumer receive transactions immediately or through buffering?
  • Which component owns the checking responsibility?
  • How can the transaction flow be observed and debugged?
Expert check: Do not memorize "port = producer, export = middle, imp = consumer" as an absolute rule. Learn to reason from the TLM interface being used and from which component initiates, forwards, or implements that interface.

Key takeaways

  • TLM allows UVM components to communicate through transactions instead of direct implementation-level dependencies.
  • Ports initiate access to a TLM interface, exports forward or expose an interface, and implementation ports provide the endpoint behavior.
  • uvm_analysis_port is particularly useful for publishing monitored transactions to multiple consumers.
  • uvm_analysis_imp connects analysis traffic to a receiving component's implementation, commonly through write().
  • Analysis FIFOs provide buffering when producer and consumer processing models require it.
  • TLM connections should normally be established in connect_phase.
  • Avoid direct monitor-to-scoreboard method calls because they tightly couple reusable components.
  • Choose TLM mechanisms according to communication semantics, not simply because a particular construct is familiar.
  • A TLM topology is not verified merely by compiling; prove that transactions traverse the intended path.
  • Keep protocol observation, transaction publication, data checking, coverage, and logging as separate responsibilities whenever practical.