Driver Architecture
Learn how a UVM driver converts sequence items into legal DUT pin activity while keeping stimulus generation, protocol timing, and verification responsibilities cleanly separated.
Learning objectives
- Explain the purpose and responsibilities of a UVM driver.
- Trace a transaction from the sequence to the DUT pins.
- Implement a driver using
get_next_item()anditem_done(). - Use a virtual interface to communicate with the DUT.
- Separate transaction intent from protocol-specific signal timing.
- Identify common driver architecture mistakes and debug them systematically.
Step 1: Understand what a driver does
A UVM driver is the component responsible for taking a sequence item and translating it into activity on the DUT interface.
The sequence describes what should happen. The driver knows how the DUT interface must be driven.
For example, a sequence might generate:
WRITE address=0x20 data=0x55
The driver converts that transaction into the actual interface behavior:
address <= 8'h20;
data <= 8'h55;
valid <= 1'b1;
wait for ready;
valid <= 1'b0;
The sequence should not need to know how many clock cycles the protocol requires or which interface signals must be asserted.
Step 2: See where the driver fits
The basic stimulus path is:
Sequence
|
| sequence item
v
Sequencer
|
| item transfer
v
Driver
|
| pin-level activity
v
DUT
|
| response
v
Monitor
|
v
Scoreboard / Coverage
Each layer has a different responsibility.
| Component | Primary responsibility |
|---|---|
| Sequence | Generate and organize transaction-level stimulus. |
| Sequencer | Manage the flow of sequence items to the driver. |
| Driver | Translate transactions into DUT interface activity. |
| DUT | Perform the design behavior being verified. |
| Monitor | Observe interface activity and reconstruct transactions. |
| Scoreboard | Check observed behavior against expected behavior. |
This separation is one of the most important architectural ideas in UVM. It allows the same driver to be reused by many different sequences and tests.
Step 3: Understand the driver class
A typical driver extends
uvm_driver parameterized with the transaction type it consumes.
class bus_driver extends uvm_driver #(bus_transaction);
`uvm_component_utils(bus_driver)
virtual bus_if vif;
function new(string name = "bus_driver",
uvm_component parent = null);
super.new(name, parent);
endfunction
endclass
The important pieces are:
uvm_driver #(bus_transaction)says what transaction type the driver receives.seq_item_portis inherited fromuvm_driver.vifgives the driver access to the DUT interface.uvm_component_utilsregisters the component with the factory.
Step 4: Understand the two sides of the driver
A driver has two important interfaces:
bus_driver
+----------------+
| |
sequence --->| seq_item_port |
| |
| protocol |----> virtual interface ----> DUT
| conversion |
| |
+----------------+
The sequence-item side receives abstract transactions. The virtual-interface side produces actual signal activity.
This gives the driver a very clear architectural boundary: transaction in, protocol activity out.
Step 5: Receive a sequence item
The standard driver loop waits for the sequencer to provide the next transaction.
task run_phase(uvm_phase phase);
forever begin
seq_item_port.get_next_item(req);
// Drive req onto the DUT interface.
seq_item_port.item_done();
end
endtask
get_next_item(req) blocks until a sequence item is available.
This means the driver does not need to poll the sequencer.
Once the item arrives, the driver processes it and eventually calls
item_done().
item_done() immediately if the DUT protocol still
requires the driver to wait for a completion condition.
Step 6: Translate the transaction into pins
Suppose the transaction contains a write request:
class bus_transaction extends uvm_sequence_item;
rand bit write;
rand bit [7:0] addr;
rand bit [7:0] data;
`uvm_object_utils(bus_transaction)
function new(string name = "bus_transaction");
super.new(name);
endfunction
endclass
The driver can translate those fields into interface signals:
vif.write <= req.write;
vif.addr <= req.addr;
vif.data <= req.data;
vif.valid <= 1'b1;
Notice that the driver knows about valid, clock cycles,
ready/response signals, and other protocol details.
The sequence does not need to know those implementation details.
Step 7: Handle protocol timing correctly
A real driver usually has to wait for some protocol completion condition.
For example, a transaction might complete when the DUT asserts
ready.
task run_phase(uvm_phase phase);
forever begin
seq_item_port.get_next_item(req);
// Present transaction.
vif.write <= req.write;
vif.addr <= req.addr;
vif.data <= req.data;
vif.valid <= 1'b1;
// Wait for a protocol transfer.
do begin
@(posedge vif.clk);
end
while (!vif.ready);
// End the transfer.
vif.valid <= 1'b0;
seq_item_port.item_done();
end
endtask
The important ordering is:
- Get the transaction.
- Drive its information onto the interface.
- Wait for the DUT protocol to complete the transfer.
- Return the interface to the appropriate idle state.
- Tell the sequencer that the item is complete.
This is much safer than treating item_done() as a simple
acknowledgment that the driver has received the object.
Step 8: Separate UVM handshake from DUT handshake
There are actually two different handshakes to understand.
| Handshake | Purpose |
|---|---|
get_next_item() / item_done() |
Coordinates the sequence, sequencer, and driver. |
valid / ready |
Implements the DUT interface protocol. |
They are related, but they are not the same thing.
Step 9: Build a reusable driver
A good driver should contain protocol behavior that is common to many tests.
For example, the driver should know how to perform:
- a legal bus write,
- a legal bus read,
- required setup and hold timing,
- valid/ready handshaking,
- idle cycles,
- protocol-specific response handling.
The sequence should instead decide things such as:
- which address to access,
- which data values to use,
- how many transactions to send,
- which scenario to execute.
This separation makes a driver reusable across directed tests, constrained-random tests, regression tests, and different sequences.
Step 10: Use the virtual interface
The driver normally accesses DUT signals through a virtual interface. The interface groups the physical signals and provides a clean connection between the testbench and DUT.
interface bus_if(input logic clk);
logic valid;
logic ready;
logic write;
logic [7:0] addr;
logic [7:0] data;
endinterface
The driver can then use:
vif.valid <= 1'b1;
vif.addr <= req.addr;
vif.data <= req.data;
The driver does not directly reference DUT hierarchy such as
dut.some_internal_signal.
That would tightly couple the driver to one particular DUT structure.
Step 11: Complete driver example
Here is a small but realistic driver architecture combining the ideas from this lesson.
class bus_driver extends uvm_driver #(bus_transaction);
`uvm_component_utils(bus_driver)
virtual bus_if vif;
function new(string name = "bus_driver",
uvm_component parent = null);
super.new(name, parent);
endfunction
task run_phase(uvm_phase phase);
forever begin
seq_item_port.get_next_item(req);
drive_transfer(req);
seq_item_port.item_done();
end
endtask
task drive_transfer(bus_transaction req);
@(posedge vif.clk);
vif.valid <= 1'b1;
vif.write <= req.write;
vif.addr <= req.addr;
vif.data <= req.data;
do begin
@(posedge vif.clk);
end
while (!vif.ready);
vif.valid <= 1'b0;
endtask
endclass
Notice the use of a helper task,
drive_transfer().
This keeps the main UVM transaction loop easy to read while isolating
protocol-specific behavior.
Step 12: Understand driver responsibilities
A driver should normally:
- receive sequence items,
- interpret transaction fields,
- drive legal DUT interface activity,
- respect protocol timing,
- wait for the appropriate completion condition,
- notify the sequencer when processing is complete,
- report useful protocol or configuration errors.
A driver should generally not:
- decide the overall test scenario,
- perform scoreboard comparisons,
- collect functional coverage,
- directly inspect DUT internals,
- randomize the entire test scenario itself.
Keeping these responsibilities separate prevents the driver from becoming a second testbench.
Step 13: Common driver mistakes
Mistake 1: Calling item_done() too early
If the driver calls item_done() before the DUT transfer
completes, the sequence may continue while the driver is still processing
the previous transaction.
Mistake 2: Forgetting item_done()
The sequence may appear to hang because the sequencer is still waiting for the driver to complete the item.
Mistake 3: Putting scenario logic in the driver
Code such as "send ten writes, then send a reset, then send five reads" belongs in a sequence or test, not in a reusable protocol driver.
Mistake 4: Driving signals without protocol timing
Assigning transaction fields to signals is not enough. The driver must implement the actual protocol rules of the interface.
Mistake 5: Direct DUT hierarchy access
Referencing internal DUT paths makes the driver fragile and difficult to reuse.
Mistake 6: No reset or idle behavior
A driver should understand what its interface should look like when it is not actively transferring a transaction, especially around reset.
Step 14: Debug a driver systematically
When a sequence appears to run but the DUT does nothing, debug from the transaction path outward.
- Did the sequence create a transaction?
- Did the sequence start on the correct sequencer?
- Did the driver receive it?
- Is the virtual interface configured?
- Did the driver drive the expected fields?
- Did the DUT protocol complete?
- Did the driver call
item_done()? - Did the monitor observe the transfer?
Temporary transaction-level messages can make this path visible:
`uvm_info("DRIVER",
$sformatf("Driving addr=0x%0h data=0x%0h",
req.addr, req.data),
UVM_MEDIUM)
The most useful debug question is often: "What is the first stage where the expected transaction disappears?"
Step 15: Driver architecture at a glance
TRANSACTION LEVEL
|
v
+---------------+
| Sequence |
+---------------+
|
v
+---------------+
| Sequencer |
+---------------+
|
UVM handshake
|
v
+---------------+
| Driver |
|---------------|
| Get item |
| Translate |
| Protocol |
| Timing |
| Complete |
+---------------+
|
Virtual Interface
|
v
+---------------+
| DUT |
+---------------+
The driver is the boundary between the abstract world of UVM transactions and the concrete world of DUT signals.
Try it yourself
Build a small bus_driver for a transaction containing
write, addr, and data.
- Extend
uvm_driver #(bus_transaction). - Add a virtual interface.
- Implement
run_phase(). - Use
get_next_item()to receive transactions. - Drive the transaction onto the interface.
- Wait for a
readyhandshake. - Return the interface to its idle state.
- Call
item_done()only after the transfer is complete.
Challenge:
Add a helper task called drive_transfer() so that
run_phase() contains only the transaction-management logic.
Key takeaways
- A driver converts sequence items into legal DUT signal activity.
- The sequence describes what should happen; the driver implements how it happens on the interface.
get_next_item()receives a transaction from the sequencer.item_done()should indicate that the driver has completed processing the item.- The virtual interface keeps the driver connected to the DUT without hard-coding DUT hierarchy.
- Protocol timing belongs in the driver, while scenario intent belongs in sequences and tests.
- A reusable driver should implement protocol behavior, not test-specific scenarios.
- When debugging, trace the transaction from sequence → sequencer → driver → interface → DUT → monitor.