UVM TLM Interface and Interface Class Method Types

As we discussed in previous chapter, In UVM (Universal Verification Methodology), communication between verification components is done using Transaction Level Modeling (TLM).

TLM-1 is a method-based transaction communication mechanism where data is exchanged using SystemVerilog class methods instead of signals.

  • Data is passed as transactions (objects)
  • Communication is point-to-point
  • Methods can be blocking or non-blocking

TLM-1 Method Types Overview

UVM TLM-1 defines four major interface method types:

  1. put
  2. get
  3. peek
  4. transport

Each method serves a specific communication purpose. In addition to blocking methods like put(), get(), and peek(), UVM TLM-1 also provides non-blocking variants.

  1. try_put()
  2. can_put()
  3. try_get()
  4. can_get()
  5. try_peek()
  6. can_peek()
  7. Analysis: write

We will discuss about each methods in detail.

put() Method:

put() is used to send a transaction from a producer to a consumer.

  • Producer pushes data
  • Consumer receives and processes it

Blocking vs Non-Blocking

  • Blocking: Producer waits until consumer accepts data
  • Non-Blocking: Producer continues immediately (try_put)
// Blocking put
seq_item_port.put(req);

get() Method

get() is used by a consumer to pull a transaction from a producer.

  • Consumer initiates the transfer
  • Producer provides the data
item_collected_port.get(tr);

An example is Scoreboard pulling transactions from a FIFO or monitor.

peek() Method

peek() allows a component to look at a transaction without removing it.

  • Transaction remains available
  • No state change
item_collected_port.peek(tr);

It checks transaction content without consuming it

transport() Method

transport() is a two-way communication method that supports request–response behavior.

  • Caller sends request
  • Callee returns response
transport(req, rsp);

Modeling master-slave or request-response protocols.

TLM-1 Ports That Use These Methods

Port TypeMethod Used
uvm_blocking_put_portput()
uvm_nonblocking_put_porttry_put()
uvm_blocking_get_portget()
uvm_blocking_peek_portpeek()
uvm_transport_porttransport()

Now let’s discuss about non-blocking variants. These methods allow components to check availability and avoid simulation stalls.

Why Non-Blocking Methods Are Needed

Blocking methods:

  • Pause execution until the transaction is accepted or available
  • Can cause deadlocks if not used carefully

Non-blocking methods:

  • Return immediately
  • Give the user control over when and how to retry

Rule of thumb:
Use non-blocking methods when you don’t want your component to wait.

Blocking vs Non-Blocking Interfaces

Each method type has blocking and non-blocking variants:

MethodBlockingNon-Blocking
putput()try_put()
getget()try_get()
peekpeek()try_peek()
transporttransport()nb_transport()

try_put()

Attempts to send a transaction without blocking.

  • Returns 1 → transaction accepted
  • Returns 0 → transaction rejected
if (!put_port.try_put(tr))
  $display("Receiver not ready");

can_put()

Checks whether the receiver can accept a transaction.

  • Returns 1 → receiver is ready
  • Returns 0 → receiver is not ready
if (put_port.can_put())
  // safe to send transaction

try_get()

Attempts to retrieve a transaction without blocking.

  • Returns 1 → transaction received
  • Returns 0 → no transaction available
if (get_port.try_get(tr))
  process(tr);

can_get()

Checks whether a transaction is available to be retrieved.

if (get_port.can_get())
  // transaction is available

try_peek()

Looks at the transaction without consuming it and without blocking.

  • Returns 1 → peek successful
  • Returns 0 → no transaction available
if (peek_port.try_peek(tr))
  $display("Observed transaction");

can_peek()

Checks whether a transaction is available for peeking.

if (peek_port.can_peek())
  // safe to peek

Peek methods do not remove the transaction from the source.

Analysis Port and write() Method

An analysis port is a special type of TLM port used for one-way, broadcast communication.

  • One producer → multiple consumers
  • No response expected
  • Non-blocking by nature

Most common usage in UVM:
Monitor → Scoreboard / Coverage / Logger

The only method used by analysis ports is write().

analysis_port.write(tr);

TLM-1 vs Analysis Port (Quick Comparison)

FeatureTLM-1 PortAnalysis Port
CommunicationPoint-to-pointBroadcast
DirectionTwo-way / One-wayOne-way
BlockingYes / NoNo
Methodput/get/peek/transportwrite()
Typical UseDriver–SequencerMonitor–Scoreboard