Cover image: UVM Sequencer and Driver Communication | The Art of Verification

The UVM Sequencer and Driver Handshake, Explained with Five Real Bugs

In short: In UVM, the sequence and the driver meet at the sequencer. The sequence calls start_item and then finish_item. The driver calls get_next_item, drives the pins, then calls item_done. finish_item doesn’t return until the driver calls item_done, so one missing item_done hangs the whole test. Read data goes back with item_done(rsp) and get_response, and the response must carry the request’s ids (set_id_info) or UVM can’t route it.

A lot of UVM hangs aren’t in the DUT at all. They’re in about five lines of code between the sequence and the driver.

The handshake is small, but the order of calls matters. Call item_done one time too few, and the test runs until a timeout kills it. Call it one time too many, and UVM stops the run.

This guide walks through the handshake call by call. Then it plants five bugs in a real bench and shows exactly what Synopsys VCS printed for each one.

What you’ll learn:

  • How the port, the export and the four calls fit together
  • What start_item and finish_item actually wait for
  • How read data gets back to the sequence, and why the sequence id matters
  • When to use try_next_item instead of get_next_item
  • How to read the UVM message each mistake produces

A simple way to picture it

Picture a kitchen order rail. The sequence clips an order slip to the rail, and the cook (the driver) takes the next slip, cooks the dish and marks the slip done.

The next slip only moves forward once the current one is marked done. Forget to mark it, and the rail jams.

That’s the whole handshake. get_next_item takes the slip, driving the pins cooks the dish, and item_done clears it.

The two ends: port and export

The driver owns a seq_item_port, the end that asks. The sequencer owns a seq_item_export, the end that supplies. One line in connect_phase joins them.

Side Object Owns Role
Requester uvm_driver seq_item_port Asks for the next item and reports when it’s done
Provider uvm_sequencer seq_item_export Hands over items that sequences produce
    function void connect_phase(uvm_phase phase);
      if (tav_bug != 5)                         // BUG 5: the one line that joins them
        drv.seq_item_port.connect(sqr.seq_item_export);
    endfunction

From tav_seqdrv.sv, lines 217 to 220. The if is only there so +BUG=5 can skip the line.

Forget this line and nothing reaches the driver. Bug 5 below shows what UVM says when that happens.

The handshake, call by call

UVM sequencer and driver handshake: finish_item returns only after the driver calls item_done
The handshake · sequence, sequencer and driver, top to bottom in time

Read it top to bottom. The driver asks first and waits. The sequence gets its grant, randomizes, and hands the item over. Then it waits inside finish_item until the driver’s item_done.

Here’s the driver’s run_phase exactly as it ran (lines 143 to 197). Ignore the lines marked BUG and the core is three calls in a forever loop: get_next_item, drive the pins, item_done.

    task run_phase(uvm_phase phase);
      tav_bus_item req, rsp;
      bit [15:0]   rdata;
      vif.valid <= 1'b0;
      forever begin
        if (use_try) begin
          seq_item_port.try_next_item(req);    // returns null if nothing is waiting
          if (req == null) begin
            @(posedge vif.clk);
            vif.valid <= 1'b0;                 // keep the bus idle, do NOT call item_done
            n_idle++;
            continue;
          end
        end
        else if (use_get)
          seq_item_port.get(req);              // takes the item AND calls item_done for you
        else
          seq_item_port.get_next_item(req);    // blocks until a sequence sends an item

        drive(req, rdata);
        n_items++;
        if (n_items == 1)
          `uvm_info("DRV", $sformatf("first item driven, done at %0t", $time), UVM_NONE)

        if (use_get) begin                     // get(): the item is already done
          if (!req.we) begin
            rsp = tav_bus_item::type_id::create("rsp");
            rsp.set_id_info(req);
            rsp.we = 0; rsp.addr = req.addr; rsp.data = rdata;
            seq_item_port.put_response(rsp);   // the read data goes back on its own
          end
          if (tav_bug == 6) seq_item_port.item_done();   // BUG 6: item_done after get
          continue;
        end

        if (req.we) begin
          if (tav_bug == 3) begin              // BUG 3: a response nobody collects
            rsp = tav_bus_item::type_id::create("rsp");
            rsp.set_id_info(req);
            rsp.we = 1; rsp.addr = req.addr; rsp.data = req.data;
            seq_item_port.item_done(rsp);
          end
          else
            seq_item_port.item_done();
          if (tav_bug == 4) seq_item_port.item_done();   // BUG 4: done twice
        end
        else begin
          if (tav_bug == 1) continue;          // BUG 1: read never completes
          rsp = tav_bus_item::type_id::create("rsp");
          if (tav_bug != 2) rsp.set_id_info(req);        // BUG 2: ids not copied
          rsp.we = 0; rsp.addr = req.addr; rsp.data = rdata;
          seq_item_port.item_done(rsp);        // item_done(rsp) also sends the response
        end
      end
    endtask

One bus beat is the drive task (lines 131 to 141): raise valid for one clock, then sample rdata on the falling edge, after the memory has registered it.

    task drive(tav_bus_item req, output bit [15:0] rdata);
      @(posedge vif.clk);
      vif.valid <= 1'b1;
      vif.we    <= req.we;
      vif.addr  <= req.addr;
      vif.wdata <= req.data;
      @(posedge vif.clk);
      vif.valid <= 1'b0;
      @(negedge vif.clk);
      rdata = vif.rdata;
    endtask

The sequence side has a matching pair:

      // 16 writes to 16 different addresses
      repeat (n) begin
        req = tav_bus_item::type_id::create("req");
        start_item(req);                         // wait for the sequencer to grant us
        if (!req.randomize() with { we == 1; !(addr inside {addrs}); })
          `uvm_fatal("SEQ", "write randomize failed")
        finish_item(req);                        // returns after the driver's item_done
        if (addrs.size() == 0)
          `uvm_info("SEQ", $sformatf("first finish_item returned at %0t", $time), UVM_NONE)
        addrs.push_back(req.addr);
        model[req.addr] = req.data;
      end

Lines 77 to 88. The uvm_info prints once, for the first write. !(addr inside {addrs}) keeps the 16 addresses different, so every read has exactly one expected value.

What start_item and finish_item actually wait for

This is the part the “start_item in uvm” searches are really asking about.

start_item asks the sequencer for a turn. The sequencer grants it when the driver asks for an item and this sequence wins arbitration. If several sequences share one sequencer, they queue up here.

finish_item hands the item to the driver, then waits until the driver calls item_done. That’s why a missing item_done hangs the sequence inside finish_item, not somewhere else.

Randomize between the two calls. Then the item gets its values at the moment it’s about to be driven, which matters when a constraint depends on the current state of the bench.

The full method map

Every call on one side has a partner on the other. Keep this table next to you when you write a new driver.

Driver side Sequence side What happens
get_next_item(req) start_item(req), then finish_item(req) The driver receives the item the sequence sent
item_done() finish_item returns The sequence is released to build the next item
item_done(rsp) get_response(rsp) The driver returns a response that the sequence reads
get(req) finish_item returns at once The item is taken and completed in one call, before it’s driven
put_response(rsp) get_response(rsp) A response sent on its own, as you must after get
try_next_item(req) same start_item / finish_item Non-blocking pull; null if nothing is waiting

One write, from sequence to pins and back

Follow one write through the bench. The timing is the same in every VCS run below.

  1. The driver calls get_next_item and waits.
  2. The sequence calls start_item. The sequencer grants it straight away, since it’s the only sequence.
  3. The sequence randomizes the item (we == 1, a fresh address) and calls finish_item.
  4. get_next_item returns in the driver with that item.
  5. On the next rising edge the driver raises valid with we, addr and wdata. One clock later it drops valid. The memory stores the data on that edge.
  6. The driver calls item_done(). finish_item returns in the sequence.
  7. The sequence saves the address and data in its model and loops. The driver loops back to get_next_item.

Each item takes 2 clocks (20 ns). That’s why 16 writes end at 320 ns, and the first read’s errors show up at 340 ns in the bug runs.

Getting read data back: item_done(rsp) and get_response

A write only needs to finish. A read has to bring data back to the sequence.

The driver builds a response item, copies the request’s ids into it with set_id_info, and hands it back with item_done(rsp). item_done(rsp) does two jobs: it releases finish_item, and it sends the response up. (A driver can also call put_response(rsp) on its own. That’s useful when the response arrives after the item is already done.)

          rsp = tav_bus_item::type_id::create("rsp");
          if (tav_bug != 2) rsp.set_id_info(req);        // BUG 2: ids not copied
          rsp.we = 0; rsp.addr = req.addr; rsp.data = rdata;
          seq_item_port.item_done(rsp);        // item_done(rsp) also sends the response

Lines 191 to 194. In the clean run tav_bug is 0, so set_id_info(req) always runs.

The sequence picks it up right after finish_item:

        finish_item(req);
        get_response(rsp);                       // the read data comes back here
        if (rsp.data === model[addrs[i]]) pass_cnt++;

Lines 96 to 98. The check uses ===, so an X on rdata counts as a fail, not a pass.

Why the sequence id matters

One sequencer can serve many sequences at once. The sequencer uses the response’s sequence id to work out which sequence the response belongs to.

A fresh rsp object has no ids. Skip set_id_info and the sequencer can’t route it. Bug 2 shows the exact message.

There’s a second trap. get_response() with no argument returns the oldest response in that sequence’s queue, not the one for the item you just sent. If the driver sends responses the sequence never collects, they pile up, and later reads pick up the wrong data. That’s Bug 3.

get_next_item vs try_next_item

Method When nothing is waiting Use it when
get_next_item Blocks until an item arrives The pins can sit still while the driver waits
try_next_item Returns null straight away The protocol needs idle cycles, a heartbeat or a clock-enable driven every cycle
        if (use_try) begin
          seq_item_port.try_next_item(req);    // returns null if nothing is waiting
          if (req == null) begin
            @(posedge vif.clk);
            vif.valid <= 1'b0;                 // keep the bus idle, do NOT call item_done
            n_idle++;
            continue;
          end
        end

Lines 148 to 156, switched on with +DRV=TRY.

Only call item_done when try_next_item actually gave you an item. With null there’s nothing to finish.

UVM driver loop flowchart: every path ends in exactly one item_done
The driver loop in tav_seqdrv.sv · one item, one item_done

Writes finish with a plain item_done(). Reads build a response with the request’s ids and finish with item_done(rsp). Either way, every item gets exactly one.

What if the driver uses get() instead of get_next_item?

It’s a common interview question, and a real choice when you write a driver.

seq_item_port.get(req) does two jobs in one call. It takes the next item, and it calls item_done for you, right away. So the sequence’s finish_item returns the moment the driver picks the item up, before a single pin has moved.

get vs get_next_item in UVM: with get(), finish_item returns before the pins move
get_next_item vs get · when finish_item returns

That one difference changes three things:

  1. finish_item no longer means “done on the bus”. With get_next_item, when finish_item returns, the beat is finished. With get, it only means the driver has taken the item. The sequence runs ahead of the bus.
  2. Read data needs its own trip back. There’s no item_done(rsp) to carry it, so the driver sends it with put_response(rsp), still with set_id_info(req). The sequence waits for it in get_response.
  3. Never call item_done after get. The item is already done. A second item_done is the same mistake as Bug 4, and it gets the same fatal. That’s Bug 6 below.

Here’s the get path in the bench (lines 157 to 176). Run it with +DRV=GET:

        else if (use_get)
          seq_item_port.get(req);              // takes the item AND calls item_done for you
        else
          seq_item_port.get_next_item(req);    // blocks until a sequence sends an item

        drive(req, rdata);
        n_items++;
        if (n_items == 1)
          `uvm_info("DRV", $sformatf("first item driven, done at %0t", $time), UVM_NONE)

        if (use_get) begin                     // get(): the item is already done
          if (!req.we) begin
            rsp = tav_bus_item::type_id::create("rsp");
            rsp.set_id_info(req);
            rsp.we = 0; rsp.addr = req.addr; rsp.data = rdata;
            seq_item_port.put_response(rsp);   // the read data goes back on its own
          end
          if (tav_bug == 6) seq_item_port.item_done();   // BUG 6: item_done after get
          continue;
        end

The two uvm_info lines (one in the driver, one in the sequence) print when the first finish_item returned and when the first item finished on the bus. Compare them in the +DRV=GET run below.

get_next_item + item_done get
When finish_item returns After the driver finishes the beat As soon as the driver takes the item
How read data gets back item_done(rsp) put_response(rsp)
Calling item_done yourself Required, exactly once Never: it’s already done
Good fit Most drivers. The sequence knows the beat is done when finish_item returns Pipelined drivers that take the next item while the last one is still on the bus

My rule of thumb: start with get_next_item. Switch to get only when the protocol overlaps transfers and you’ve planned how responses come back.

The bench: one file, five planted bugs

The bench is one file, tav_seqdrv.sv (download it as a zip, 3 KB). It drives a tiny 256 x 16 memory, writes 16 random addresses, then reads each one back and checks the data.

Each bug sits behind a run option, so the clean bench and the broken ones are the same code.

tav_seqdrv bench: test, sequence, agent with sequencer and driver, interface and memory
The bench · test, agent, interface and memory
Run option What changes The mistake it copies
(none) Clean: get_next_item, item_done, responses with set_id_info
+DRV=TRY Driver uses try_next_item and drives idle cycles
+DRV=GET Driver uses get, and sends read data with put_response
+BUG=1 Driver skips item_done on reads A code path that forgets to finish the item
+BUG=2 Read response sent without set_id_info Building a fresh response object and forgetting its ids
+BUG=3 Driver also sends a response for every write, which the sequence never collects Sending responses nobody asked for
+BUG=4 Driver calls item_done twice per write An extra item_done on an early-exit path
+BUG=5 Agent never connects seq_item_port A missing connect line
+DRV=GET +BUG=6 Driver calls item_done after get Treating get like get_next_item

The test sets set_timeout(50us), so a hang ends with a timeout message instead of running forever.

The full code: tav_seqdrv.sv

This is the exact file that runs on VCS: 267 lines, one file. Paste it into testbench.sv on EDA Playground, leave design.sv empty, choose Synopsys VCS with UVM 1.2, and add a run option from the table above.

// tav_seqdrv.sv : UVM sequencer and driver handshake, with planted bugs.
// The Art of Verification (theartofverification.com)
//
// Run on: Synopsys VCS with UVM 1.2 (EDA Playground), date to be filled after the run.
// Paste into testbench.sv, leave design.sv empty. Top module: tav_top.
//
// Design: a tiny 256 x 16 memory. One bus beat = valid high for one clock.
//   we = 1 writes wdata to addr. we = 0 returns mem[addr] on rdata one clock later.
//
// The sequence writes 16 random addresses, then reads each one back and checks
// the data. It prints one PASS/FAIL line and a summary.
//
// Run options:
//   (none)     clean run: get_next_item, item_done, responses with set_id_info
//   +DRV=TRY   clean run with try_next_item; the driver drives idle cycles
//   +DRV=GET   clean run with get(); the response goes back with put_response
//   +BUG=1     driver skips item_done on reads        -> finish_item hangs
//   +BUG=2     read response sent without set_id_info -> response has no sequence id
//   +BUG=3     driver also returns a response for every write, the sequence
//              only collects reads                     -> response queue overflow
//   +BUG=4     driver calls item_done twice per write  -> no outstanding request
//   +BUG=5     agent never connects seq_item_port      -> driver pulls from nothing
//   +BUG=6     with +DRV=GET, driver also calls item_done -> get() already did it

`timescale 1ns/1ps
`include "uvm_macros.svh"

interface tav_bus_if (input logic clk);
  logic        valid;
  logic        we;
  logic [7:0]  addr;
  logic [15:0] wdata;
  logic [15:0] rdata;
endinterface

module tav_mem (tav_bus_if bus);
  logic [15:0] mem [256];
  always_ff @(posedge bus.clk) begin
    if (bus.valid &&  bus.we) mem[bus.addr] <= bus.wdata;
    if (bus.valid && !bus.we) bus.rdata     <= mem[bus.addr];
  end
endmodule

package tav_seqdrv_pkg;
  import uvm_pkg::*;

  int unsigned tav_bug;   // value of +BUG=n, 0 when absent

  class tav_bus_item extends uvm_sequence_item;
    `uvm_object_utils(tav_bus_item)
    rand bit        we;
    rand bit [7:0]  addr;
    rand bit [15:0] data;
    function new(string name = "tav_bus_item");
      super.new(name);
    endfunction
    function string convert2string();
      return $sformatf("%s addr=0x%02h data=0x%04h", we ? "WR" : "RD", addr, data);
    endfunction
  endclass

  typedef uvm_sequencer #(tav_bus_item) tav_bus_sequencer;

  class tav_wr_rd_seq extends uvm_sequence #(tav_bus_item);
    `uvm_object_utils(tav_wr_rd_seq)
    int unsigned n = 16;
    int unsigned pass_cnt, fail_cnt;
    function new(string name = "tav_wr_rd_seq");
      super.new(name);
    endfunction

    task body();
      tav_bus_item req, rsp;
      bit [7:0]    addrs[$];
      bit [15:0]   model[bit [7:0]];

      // 16 writes to 16 different addresses
      repeat (n) begin
        req = tav_bus_item::type_id::create("req");
        start_item(req);                         // wait for the sequencer to grant us
        if (!req.randomize() with { we == 1; !(addr inside {addrs}); })
          `uvm_fatal("SEQ", "write randomize failed")
        finish_item(req);                        // returns after the driver's item_done
        if (addrs.size() == 0)
          `uvm_info("SEQ", $sformatf("first finish_item returned at %0t", $time), UVM_NONE)
        addrs.push_back(req.addr);
        model[req.addr] = req.data;
      end

      // read each one back and check it
      foreach (addrs[i]) begin
        req = tav_bus_item::type_id::create("req");
        start_item(req);
        if (!req.randomize() with { we == 0; addr == addrs[i]; })
          `uvm_fatal("SEQ", "read randomize failed")
        finish_item(req);
        get_response(rsp);                       // the read data comes back here
        if (rsp.data === model[addrs[i]]) pass_cnt++;
        else begin
          fail_cnt++;
          if (fail_cnt <= 3)
            `uvm_error("SEQ", $sformatf("read 0x%02h: got 0x%04h, expected 0x%04h",
                                        addrs[i], rsp.data, model[addrs[i]]))
        end
      end
    endtask
  endclass

  class tav_bus_driver extends uvm_driver #(tav_bus_item);
    `uvm_component_utils(tav_bus_driver)
    virtual tav_bus_if vif;
    bit          use_try, use_get;
    int unsigned n_items, n_idle;

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

    function void build_phase(uvm_phase phase);
      string mode;
      super.build_phase(phase);
      if (!uvm_config_db #(virtual tav_bus_if)::get(this, "", "vif", vif))
        `uvm_fatal("NOVIF", "no virtual interface for the driver")
      if ($value$plusargs("DRV=%s", mode)) begin
        use_try = (mode == "TRY");
        use_get = (mode == "GET");
      end
    endfunction

    // one beat: valid for one clock, read data sampled after the DUT registers it
    task drive(tav_bus_item req, output bit [15:0] rdata);
      @(posedge vif.clk);
      vif.valid <= 1'b1;
      vif.we    <= req.we;
      vif.addr  <= req.addr;
      vif.wdata <= req.data;
      @(posedge vif.clk);
      vif.valid <= 1'b0;
      @(negedge vif.clk);
      rdata = vif.rdata;
    endtask

    task run_phase(uvm_phase phase);
      tav_bus_item req, rsp;
      bit [15:0]   rdata;
      vif.valid <= 1'b0;
      forever begin
        if (use_try) begin
          seq_item_port.try_next_item(req);    // returns null if nothing is waiting
          if (req == null) begin
            @(posedge vif.clk);
            vif.valid <= 1'b0;                 // keep the bus idle, do NOT call item_done
            n_idle++;
            continue;
          end
        end
        else if (use_get)
          seq_item_port.get(req);              // takes the item AND calls item_done for you
        else
          seq_item_port.get_next_item(req);    // blocks until a sequence sends an item

        drive(req, rdata);
        n_items++;
        if (n_items == 1)
          `uvm_info("DRV", $sformatf("first item driven, done at %0t", $time), UVM_NONE)

        if (use_get) begin                     // get(): the item is already done
          if (!req.we) begin
            rsp = tav_bus_item::type_id::create("rsp");
            rsp.set_id_info(req);
            rsp.we = 0; rsp.addr = req.addr; rsp.data = rdata;
            seq_item_port.put_response(rsp);   // the read data goes back on its own
          end
          if (tav_bug == 6) seq_item_port.item_done();   // BUG 6: item_done after get
          continue;
        end

        if (req.we) begin
          if (tav_bug == 3) begin              // BUG 3: a response nobody collects
            rsp = tav_bus_item::type_id::create("rsp");
            rsp.set_id_info(req);
            rsp.we = 1; rsp.addr = req.addr; rsp.data = req.data;
            seq_item_port.item_done(rsp);
          end
          else
            seq_item_port.item_done();
          if (tav_bug == 4) seq_item_port.item_done();   // BUG 4: done twice
        end
        else begin
          if (tav_bug == 1) continue;          // BUG 1: read never completes
          rsp = tav_bus_item::type_id::create("rsp");
          if (tav_bug != 2) rsp.set_id_info(req);        // BUG 2: ids not copied
          rsp.we = 0; rsp.addr = req.addr; rsp.data = rdata;
          seq_item_port.item_done(rsp);        // item_done(rsp) also sends the response
        end
      end
    endtask

    function void report_phase(uvm_phase phase);
      `uvm_info("DRV", $sformatf("items driven: %0d, idle cycles: %0d (%s)",
                n_items, n_idle, use_try ? "try_next_item" : use_get ? "get" : "get_next_item"), UVM_NONE)
    endfunction
  endclass

  class tav_bus_agent extends uvm_agent;
    `uvm_component_utils(tav_bus_agent)
    tav_bus_sequencer sqr;
    tav_bus_driver    drv;
    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction
    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      sqr = tav_bus_sequencer::type_id::create("sqr", this);
      drv = tav_bus_driver::type_id::create("drv", this);
    endfunction
    function void connect_phase(uvm_phase phase);
      if (tav_bug != 5)                         // BUG 5: the one line that joins them
        drv.seq_item_port.connect(sqr.seq_item_export);
    endfunction
  endclass

  class tav_seqdrv_test extends uvm_test;
    `uvm_component_utils(tav_seqdrv_test)
    tav_bus_agent agt;
    tav_wr_rd_seq seq;
    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction
    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      void'($value$plusargs("BUG=%d", tav_bug));
      agt = tav_bus_agent::type_id::create("agt", this);
      uvm_root::get().set_timeout(50us, 1);    // a hang ends here instead of running forever
    endfunction
    task run_phase(uvm_phase phase);
      phase.raise_objection(this);
      seq = tav_wr_rd_seq::type_id::create("seq");
      seq.start(agt.sqr);
      phase.drop_objection(this);
    endtask
    function void report_phase(uvm_phase phase);
      uvm_report_server rs = uvm_report_server::get_server();
      int unsigned errs = rs.get_severity_count(UVM_ERROR) + rs.get_severity_count(UVM_FATAL);
      `uvm_info("TEST", $sformatf("BUG=%0d reads checked: %0d pass, %0d fail", tav_bug,
                seq.pass_cnt, seq.fail_cnt), UVM_NONE)
      if (errs == 0 && seq.pass_cnt == seq.n) `uvm_info("TEST", "*** TEST PASSED ***", UVM_NONE)
      else                                    `uvm_info("TEST", "*** TEST FAILED ***", UVM_NONE)
    endfunction
  endclass
endpackage

module tav_top;
  import uvm_pkg::*;
  import tav_seqdrv_pkg::*;

  logic clk = 0;
  always #5 clk = ~clk;

  tav_bus_if bus (clk);
  tav_mem    dut (bus);

  initial begin
    uvm_config_db #(virtual tav_bus_if)::set(null, "uvm_test_top.agt.drv", "vif", bus);
    run_test("tav_seqdrv_test");
  end
endmodule

What VCS printed

Run on Synopsys VCS X-2025.06-SP1 with UVM 1.2 on EDA Playground, 27 Nov 2026. Each block is copied from the log. Times are in picoseconds (the file uses timescale 1ns/1ps), so @ 640000 means 640 ns, and “…” marks lines I cut.

Line numbers in the log run 2 ahead of the listing above. The run’s testbench.sv kept EDA Playground’s two default comment lines at the top.

Clean run:

UVM_INFO @ 0: reporter [RNTST] Running test tav_seqdrv_test...
UVM_INFO testbench.sv(167) @ 20000: uvm_test_top.agt.drv [DRV] first item driven, done at 20000
UVM_INFO testbench.sv(87) @ 20000: uvm_test_top.agt.sqr@@seq [SEQ] first finish_item returned at 20000
UVM_INFO .../uvm_objection.svh(1276) @ 640000: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase
UVM_INFO testbench.sv(202) @ 640000: uvm_test_top.agt.drv [DRV] items driven: 32, idle cycles: 0 (get_next_item)
UVM_INFO testbench.sv(247) @ 640000: uvm_test_top [TEST] BUG=0 reads checked: 16 pass, 0 fail
UVM_INFO testbench.sv(249) @ 640000: uvm_test_top [TEST] *** TEST PASSED ***

UVM_ERROR :    0
UVM_FATAL :    0

Both first-item lines print at 20 ns. The driver finishes the first beat and calls item_done, and finish_item returns in the same time step. 32 items (16 writes, 16 reads) at 20 ns each end the run at 640 ns.

+DRV=TRY:

UVM_INFO testbench.sv(167) @ 20000: uvm_test_top.agt.drv [DRV] first item driven, done at 20000
UVM_INFO testbench.sv(87) @ 20000: uvm_test_top.agt.sqr@@seq [SEQ] first finish_item returned at 20000
UVM_INFO testbench.sv(202) @ 640000: uvm_test_top.agt.drv [DRV] items driven: 32, idle cycles: 0 (try_next_item)
UVM_INFO testbench.sv(247) @ 640000: uvm_test_top [TEST] BUG=0 reads checked: 16 pass, 0 fail
UVM_INFO testbench.sv(249) @ 640000: uvm_test_top [TEST] *** TEST PASSED ***

Zero idle cycles. The sequence sends items back to back, so try_next_item always found one waiting. The idle branch only matters when the stimulus has gaps.

+BUG=1, no item_done on reads:

UVM_ERROR @ 340000: uvm_test_top.agt.sqr [uvm_test_top.agt.sqr] Get_next_item called twice without item_done or get in between
UVM_ERROR @ 360000: uvm_test_top.agt.sqr [uvm_test_top.agt.sqr] Get_next_item called twice without item_done or get in between
... 2,481 more of the same line, one every 20 ns ...
UVM_FATAL .../uvm_phase.svh(1512) @ 50000000: reporter [PH_TIMEOUT] Explicit timeout of 50000000 hit, indicating a probable testbench issue

UVM_ERROR : 2483
UVM_FATAL :    1

This isn’t a quiet hang. The second get_next_item doesn’t block: it hands back the same unfinished read. So the driver drives that one read over and over, one beat every 20 ns, logging an error each time, until the 50 us timeout ends the run. The sequence never gets past finish_item on its first read. The first error lands at 340 ns, right after the 16 writes.

+BUG=2, no set_id_info:

UVM_FATAL @ 340000: uvm_test_top.agt.sqr [SQRPUT] Driver put a response with null sequence_id

This one is loud and immediate. It’s a fatal on the very first read response, at 340 ns. The ID to remember is SQRPUT.

+BUG=3, responses nobody collects:

UVM_ERROR @ 180000: uvm_test_top.agt.sqr@@seq [uvm_test_top.agt.sqr.seq] Response queue overflow, response was dropped
... 7 more at 200000 to 320000 ...
UVM_ERROR @ 340000: uvm_test_top.agt.sqr@@seq [uvm_test_top.agt.sqr.seq] Response queue overflow, response was dropped
UVM_ERROR testbench.sv(104) @ 500000: uvm_test_top.agt.sqr@@seq [SEQ] read 0x47: got 0xb9da, expected 0x199b
UVM_ERROR testbench.sv(104) @ 520000: uvm_test_top.agt.sqr@@seq [SEQ] read 0x9f: got 0x27c0, expected 0xd404
UVM_ERROR testbench.sv(104) @ 540000: uvm_test_top.agt.sqr@@seq [SEQ] read 0xba: got 0x5bbe, expected 0x93f8
UVM_INFO testbench.sv(247) @ 640000: uvm_test_top [TEST] BUG=3 reads checked: 8 pass, 8 fail
UVM_INFO testbench.sv(250) @ 640000: uvm_test_top [TEST] *** TEST FAILED ***

This is the sneakiest result of the five. The response queue holds 8, so from the 9th write on, responses are dropped: 9 overflow errors. The 9th is the first read’s own response.

Then look at the score: 8 pass, 8 fail. The first 8 reads “passed” while reading back write responses. Each write response carried the data written to the same address, in the same order, so the check matched by luck. Reads 9 to 16 got read responses shifted by one, because the first one was dropped, and failed.

A check that passes for the wrong reason is worse than one that fails. Without the overflow errors you’d never know.

+BUG=4, item_done twice:

UVM_FATAL @ 20000: uvm_test_top.agt.sqr [uvm_test_top.agt.sqr] Item_done() called with no outstanding requests. Each call to item_done() must be paired with a previous call to get_next_item().

Fatal at 20 ns, on the very first write. The message even tells you the rule.

+BUG=5, no connect:

Error-[NOA] Null object access
/apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/tlm1/uvm_sqr_connections.svh, 45
  The object at dereference depth 1 is being used before it was 
  constructed/allocated.
  ...
  #0 in 
  \uvm_seq_item_pull_port#(tav_seqdrv_pkg::tav_bus_item,tav_seqdrv_pkg::tav_bus_item)::get_next_item
  ...
  #1 in \tav_bus_driver::run_phase  at testbench.sv:162

No UVM message at all. The port is allowed zero connections, so elaboration doesn’t complain. Then the first get_next_item calls through a null handle and VCS stops the run with a null object access.

The clue is in the stack trace: uvm_seq_item_pull_port ... get_next_item, called from your driver’s run_phase (testbench.sv:162 in the log). When you see that, check the connect line first.

+DRV=GET, get instead of get_next_item:

UVM_INFO testbench.sv(87) @ 0: uvm_test_top.agt.sqr@@seq [SEQ] first finish_item returned at 0
UVM_INFO testbench.sv(167) @ 20000: uvm_test_top.agt.drv [DRV] first item driven, done at 20000
UVM_INFO testbench.sv(202) @ 640000: uvm_test_top.agt.drv [DRV] items driven: 32, idle cycles: 0 (          get)
UVM_INFO testbench.sv(247) @ 640000: uvm_test_top [TEST] BUG=0 reads checked: 16 pass, 0 fail
UVM_INFO testbench.sv(249) @ 640000: uvm_test_top [TEST] *** TEST PASSED ***

Compare the first two lines with the clean run. Now the sequence line prints first, at 0 ns, a full 20 ns before the beat is done on the bus. That’s get() calling item_done the moment the driver takes the item.

Reads still pass, because each one waits in get_response until the driver’s put_response arrives. The spaces before “get” are VCS padding the shorter string to the width of “get_next_item” in the ternary, not a bug in the bench.

+DRV=GET +BUG=6, item_done after get:

UVM_INFO testbench.sv(87) @ 0: uvm_test_top.agt.sqr@@seq [SEQ] first finish_item returned at 0
UVM_INFO testbench.sv(167) @ 20000: uvm_test_top.agt.drv [DRV] first item driven, done at 20000
UVM_FATAL @ 20000: uvm_test_top.agt.sqr [uvm_test_top.agt.sqr] Item_done() called with no outstanding requests. Each call to item_done() must be paired with a previous call to get_next_item().

UVM_FATAL :    1

The same fatal as Bug 4, at the same 20 ns, on the very first item. get() already finished the item, so the driver’s own item_done has nothing left to finish.

What each message tells you

You see Most likely cause
Get_next_item called twice without item_done or get in between, repeating every few cycles A code path that skips item_done; the driver keeps re-driving the same item
[PH_TIMEOUT] Explicit timeout ... hit Something never finished; scroll up for the first error
[SQRPUT] Driver put a response with null sequence_id Response built without set_id_info(req)
Response queue overflow, response was dropped Responses sent that the sequence never collects
Item_done() called with no outstanding requests item_done called twice, or after try_next_item returned null
Error-[NOA] Null object access inside uvm_seq_item_pull_port::get_next_item seq_item_port never connected

Common mistakes (and the fix for each)

  1. A code path that skips item_done. The sequence waits in finish_item forever. Fix: make every path through the driver loop end in exactly one item_done. (Bug 1)
  2. A response without set_id_info. UVM can’t tell which sequence it belongs to. Fix: call rsp.set_id_info(req) right after you create rsp. (Bug 2)
  3. Responses nobody collects. They pile up in the sequence’s response queue, and get_response() hands back the oldest one, which can be the wrong one. Fix: only send a response when the sequence will call get_response, or turn responses off for that sequence with use_response_handler. (Bug 3)
  4. item_done twice. Often on an early-exit path. Fix: one item, one item_done. (Bug 4)
  5. No connect line. Fix: drv.seq_item_port.connect(sqr.seq_item_export) in the agent’s connect_phase. (Bug 5)
  6. item_done after try_next_item returned null. Same symptom as Bug 4. Fix: only call it inside the req != null branch.

When a sequence hangs: a 5-step check

  1. Find where it’s stuck. If the log or a $display shows the sequence inside finish_item, the driver never called item_done for that item.
  2. Find where the driver is stuck. Inside get_next_item with no item means the sequence never reached finish_item, or the port isn’t connected.
  3. Search the log for sequencer warnings and errors, and see whether get_next_item was called twice without an item_done in between.
  4. Count the calls. Items sent by the sequence, get_next_item calls and item_done calls should all match.
  5. Check responses. Every get_response needs a response with the right ids, and every response sent needs a get_response.

Where AI helps, and where it doesn’t

An AI assistant can read a long UVM log and point at the line that matters, like a timeout after a sequence stopped in finish_item. That saves real time on a 50,000-line log.

It can’t see your waveform, though, and it will happily suggest a fix that looks right but isn’t. Treat its answer as a lead. Confirm the missing item_done in your own code and rerun before you believe it.

Practice challenge

Take tav_seqdrv.sv and add +BUG=7. The driver gets a response from the bus two items later (pipelined) and sends it with put_response instead of item_done(rsp).

Then change the sequence so each read collects its own response by transaction id. Hint: get_response(rsp, req.get_transaction_id()). Does every read still pass?

FAQ

What connects the driver to the sequencer? The driver’s seq_item_port and the sequencer’s seq_item_export, joined in connect_phase with drv.seq_item_port.connect(sqr.seq_item_export).

Why does my sequence hang at finish_item? Because the driver never called item_done for that item. finish_item only returns after item_done.

What does start_item wait for? A grant from the sequencer. It comes when the driver asks for an item and this sequence wins arbitration.

What is the sequence id in UVM? A number the sequencer uses to route a response back to the sequence that sent the request. set_id_info(req) copies it, with the transaction id, into a response.

What is the difference between get_next_item and try_next_item? get_next_item blocks until an item arrives. try_next_item returns null straight away when nothing is waiting, so the driver can keep the pins busy.

Do I call item_done after try_next_item returns null? No. Only call it when you actually received an item.

Can more than one sequence talk to one driver? Yes. Several sequences can run on the same sequencer, and the sequencer’s arbitration decides whose item reaches the driver next. The driver doesn’t know or care which sequence sent an item. That’s exactly why responses need the sequence id: it’s how each response finds its way back.

What happens if I call get_next_item twice without item_done? UVM logs “Get_next_item called twice without item_done or get in between” and hands back the same item again. In our Bug 1 run, that meant 2,483 errors in 50 us.

What is the difference between get and get_next_item in UVM? get_next_item takes the item and waits for you to call item_done, so finish_item returns only after the item is driven. get takes the item and completes it in the same call, so finish_item returns straight away. With get, send read data with put_response(rsp) and never call item_done.

References

Keep learning

This handshake sits at the bottom of the whole stack. See how the driver and sequencer fit the bigger picture in the UVM testbench architecture guide, learn how items are scheduled when several sequences compete in UVM sequence arbitration, and see the difference between the two sequencer handles in m_sequencer vs p_sequencer. Build the whole flow from scratch in how to build a UVM environment part 2, and find more on the UVM category page.

If your test runs but never finishes, the cause is often an objection rather than the handshake: see why your UVM test never ends.