Module 3: Phases and Transactions | Lesson 27

Transaction Design

Learn how to model meaningful DUT activity as reusable transactions that can be generated, driven, monitored, checked, and debugged.

Learning objectives

  • Explain what a verification transaction represents.
  • Understand why UVM separates transactions from pin-level activity.
  • Design a transaction around protocol intent rather than signal implementation.
  • Create a basic SystemVerilog transaction class.
  • Identify fields that belong in a transaction and fields that usually do not.
  • Understand how transactions flow between sequences, drivers, monitors, and scoreboards.
  • Recognize common transaction-design mistakes.

Step 1: What is a transaction?

A transaction is an object that represents a meaningful piece of activity from the perspective of the protocol or DUT behavior.

Instead of thinking about individual signals such as addr, data, valid, and ready, a verification engineer can think in terms of an operation:

WRITE address=0x1000 data=0x55

The transaction captures the information needed to describe that operation. The driver later converts that transaction into the actual pin-level activity required by the DUT.

Core idea: A transaction describes what happened. A driver or monitor deals with how it happened on the interface.

Step 2: Why do we need transactions?

Real interfaces contain many signals and often require several clock cycles to complete one operation. If every part of the testbench worked directly with individual signals, the verification environment would become difficult to reuse and debug.

Transactions create an abstraction layer:

Sequence


|
| transaction
v
Sequencer
|
| transaction
v
Driver
|
| pin-level protocol
v
DUT
|
| pin-level response
v
Monitor
|
| transaction
v
Scoreboard / Coverage / Subscribers

Notice that most of the verification environment can work with transactions without knowing the exact timing of the interface.

This separation is one of the most important ideas in UVM: stimulus and checking operate at the transaction level, while drivers and monitors translate between transactions and signals.

Step 3: Design around the operation, not the wires

Suppose a bus has these signals:

clk


reset_n
valid
ready
write
addr
wdata
rdata

A beginner might create a transaction containing every signal:

class bad_transaction extends uvm_sequence_item;


bit        valid;
bit        ready;
bit        write;
bit [31:0] addr;
bit [31:0] wdata;
bit [31:0] rdata;

endclass

This can be misleading. Some of these signals are controlled by the DUT, some are controlled by the testbench, and some are protocol state rather than transaction intent.

A better transaction describes the operation the verification environment wants to perform:

class bus_transaction extends uvm_sequence_item;


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

endclass

The driver can use these fields to generate the appropriate bus handshake. The monitor can reconstruct a transaction from the observed bus activity.

Design rule: Include information that describes the transaction or is required to verify it. Do not automatically copy every interface signal into the transaction.

Step 4: A transaction is a data model

Think of a transaction as a small data model for one operation.

For example, a memory transaction might contain:

class memory_transaction extends uvm_sequence_item;


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

`uvm_object_utils(memory_transaction)

function new(string name = "memory_transaction");
super.new(name);
endfunction

endclass

The object answers questions such as:

  • Is this a read or a write?
  • Which address is being accessed?
  • What data is associated with the operation?

This object can later be passed through the UVM environment without carrying unnecessary implementation details.

Step 5: Understand the transaction lifecycle

The same transaction concept can appear at several points in a UVM testbench.

1. Sequence creates the intent

req = memory_transaction::type_id::create("req");

The sequence creates and prepares a transaction representing the desired operation.

2. Sequencer transfers the transaction

The sequencer provides the transaction to the driver through the standard sequence-driver mechanism.

3. Driver converts it to signals

seq_item_port.get_next_item(req);


// Use req.write, req.address, and req.data
// to drive the DUT interface.

seq_item_port.item_done();

The driver owns the protocol timing. The transaction does not need to know how many clock cycles are required.

4. Monitor reconstructs observed behavior

The monitor watches the interface and creates a transaction representing what actually occurred.

5. Scoreboard checks the transaction

The scoreboard can compare the observed transaction with expected behavior.

Important: A transaction can represent either requested behavior or observed behavior. In many environments, the same transaction type is used for both, although more complex protocols may use different request and response transaction types.

Step 6: What belongs in a transaction?

A good transaction contains information that is meaningful at the transaction level.

Field Usually belongs? Reason
Address Yes Describes the operation.
Write/read direction Yes Describes the operation.
Write data Yes Part of the requested operation.
Response data Often Useful when modeling a completed transaction.
Clock No Usually belongs to the interface/driver/monitor.
Valid signal Usually no Often protocol implementation rather than transaction intent.
Ready signal Usually no Often controlled by the receiving side of the protocol.

There is no universal list. The correct fields depend on what the transaction is intended to represent and how the verification environment uses it.

Step 7: Request data versus observed data

A useful distinction is between what the test requested and what the DUT actually produced.

For example:

Request:


write = 0
address = 32'h1000

Observed response:
data = 32'h00000055

The sequence may create the request transaction, while the monitor creates an observed transaction after seeing the DUT respond.

This distinction becomes especially important for read operations, responses, errors, retries, and protocols where the DUT changes or adds information.

Step 8: Transaction design and UVM class hierarchy

UVM transactions are normally derived from uvm_sequence_item. This gives them the behavior required to participate in the UVM sequence mechanism.

class bus_transaction extends uvm_sequence_item;


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

`uvm_object_utils(bus_transaction)

function new(string name = "bus_transaction");
super.new(name);
endfunction

endclass

For now, focus on the data model itself. The next lesson will explain uvm_sequence_item in much greater detail and show how transaction objects are used by sequences and drivers.

Step 9: Why transactions should be reusable

A well-designed transaction should be usable by multiple parts of the environment.

The same transaction might be used by:

  • a sequence to generate stimulus,
  • a driver to control the DUT,
  • a monitor to represent observed activity,
  • a scoreboard to compare expected and actual behavior,
  • a coverage collector to measure scenarios,
  • a debug printout to explain what happened.

This is why transaction design matters. A poorly designed transaction forces every downstream component to understand unnecessary implementation details.

Step 10: Common transaction-design mistakes

Mistake 1: Copying every interface signal

A transaction is not necessarily a mirror of the interface. Start with protocol meaning and add fields when they provide verification value.

Mistake 2: Mixing request and response semantics

Be clear about whether a field represents requested stimulus, observed behavior, or a response from the DUT.

Mistake 3: Putting timing inside the transaction

Avoid making the transaction responsible for clock cycles, signal toggling, or interface handshakes. That behavior belongs in the driver or monitor.

Mistake 4: Making the transaction too specific

If a transaction can only be understood by one driver implementation, it becomes harder to reuse for checking, coverage, or another interface configuration.

Mistake 5: Designing before defining the verification requirement

First ask what you need to generate, observe, and check. Then define the transaction fields required to support those tasks.

Step 11: A practical design process

When creating a new transaction, use this sequence:

  1. Identify the operation. What meaningful action does one transaction represent?
  2. List the required information. What must the driver know to perform it?
  3. List the observed information. What must the monitor capture to describe what happened?
  4. Separate intent from protocol timing. Keep clock-level behavior in the driver and monitor.
  5. Add verification metadata only when useful. Examples include status, response data, or transaction IDs.
  6. Make the object printable and debuggable. You should be able to understand a transaction from a log message.
Verification mindset: If you cannot describe your transaction in one clear sentence, the transaction model may not yet be well defined.

Step 12: Trace one transaction through the environment

Consider a write operation:

Transaction:


write = 1
addr  = 0x1000
data  = 0x55

The verification flow becomes:

Sequence


|
| "Write 0x55 to 0x1000"
v
Transaction
|
v
Sequencer
|
v
Driver
|
| valid/write/address/data
v
DUT
|
| observed bus activity
v
Monitor
|
v
Observed Transaction
|
+----------> Scoreboard
|
+----------> Coverage
|
+----------> Debug / Logging

This is the foundation of transaction-level UVM architecture. Later lessons will add constraints, sequence items, TLM connections, and scoreboards to this flow.

Step 13: Debugging transaction problems

When a scoreboard receives an unexpected transaction, do not immediately modify the scoreboard. Trace the transaction backward through the environment.

  1. Was the sequence transaction created correctly?
  2. Did the sequencer deliver the expected transaction?
  3. Did the driver interpret the fields correctly?
  4. Did the DUT receive the intended operation?
  5. Did the monitor sample the correct protocol event?
  6. Did the monitor construct the transaction correctly?
  7. Did the scoreboard receive the expected transaction?

This creates a powerful debugging rule:

Debug the first incorrect transaction, not the last component that complained.

Try it yourself

Design a transaction for a simple FIFO.

Decide what fields are needed for:

  • a write operation,
  • a read operation,
  • observed read data,
  • an empty/full response or status indication.

Then write a basic uvm_sequence_item containing your chosen fields. For each field, write one sentence explaining why it belongs in the transaction.

Challenge: Identify three FIFO interface signals that should usually remain outside the transaction because they describe protocol timing rather than transaction intent.

Key takeaways

  • A transaction is a data model for a meaningful protocol operation.
  • Transactions separate verification intent from pin-level implementation.
  • Drivers translate transactions into DUT signals.
  • Monitors translate observed DUT activity back into transactions.
  • Sequences, scoreboards, coverage, and debug logic can operate at the transaction level.
  • Do not automatically copy every interface signal into a transaction.
  • Keep protocol timing and signal manipulation in drivers and monitors.
  • Be explicit about request, response, and observed transaction semantics.
  • A reusable transaction model makes the entire UVM environment easier to maintain and debug.
  • The next step is learning how uvm_sequence_item turns this transaction model into a first-class UVM object.