Why Does My UVM Test Never End?
In short: a UVM test ends when the run phase has no objections left. A test that never ends almost always means one of two things. Someone raised an objection and never dropped it, or someone is waiting for something that will never happen. The objection list tells you who is waiting. A few counters tell you what they are waiting for.
That second question is where the hours go.
I planted five hangs in one small UVM bench and ran each one on Synopsys VCS.
Only one was the classic stuck objection.
In the other four, the only objection left was the test’s own. The test was waiting, patiently, for something that was never coming.
This guide shows how a UVM test decides to end, what VCS printed for each of the five hangs, and a 5-minute triage that tells them apart.
How a UVM test ends
New to objections? Start with How to Terminate UVM Test? (UVM Objections), lesson 18 of the UVM path. This section is the short version, so the hangs below make sense.
The picture: an office that won’t lock up
The guard locks the office when the sign-in sheet is empty. The guard only reads the sheet. He has no idea what anyone inside is actually doing.
So when the office never locks, the sheet tells you who is still signed in. It never tells you why they’re still there. For that you need the delivery log.
| The office that won’t lock | In UVM | Run |
|---|---|---|
| Someone went home without signing out | A component raised and never dropped | BUG=1 |
| The courier keeps bringing back the same parcel, because nobody signed for it | The driver never called item_done() | BUG=2 |
| The manager waits for 20 parcels and the mail room lost one | The DUT dropped data | BUG=3 |
| The power never came on, so nothing moves at all | The clock never started | BUG=4 |
| The manager waits for 23 parcels when only 20 were ordered | The end condition is wrong | BUG=5 |
In the last four, the only name left on the sheet is the manager’s: the test itself. The sheet looks the same every time. The delivery log, your counters, is what tells them apart.
Here is the order UVM follows:
run_phasestarts in every component at the same time.- The test raises an objection before it starts its sequence.
- Drivers and monitors loop forever. The phase can end without them holding an objection, so most benches leave them out.
- The test drops its objection when its end condition is met, for example “the scoreboard matched every item I sent”.
- When the count reaches 0, UVM waits for the drain time, if one is set. That gives in-flight data time to reach the scoreboard.
- UVM calls
phase_ready_to_end()in every component. A component that still has work, like a scoreboard with items in its queue, can raise again here. - Only then does the test move on to extract, check and report.
If the count never reaches 0, UVM waits for its global timeout. In UVM 1.2 that default is 9200 seconds of simulated time. On a slow bench, that’s a regression slot gone for hours.
// Not simulation-tested: the usual shape of a test that ends cleanly
task run_phase(uvm_phase phase);
my_seq seq = my_seq::type_id::create("seq");
phase.raise_objection(this, "sending stimulus");
phase.phase_done.set_drain_time(this, 100ns); // let the last items reach the scoreboard
seq.start(env.agt.sqr);
wait (env.sb.matched == seq.num_items); // the end condition
phase.drop_objection(this, "all items matched");
endtask
Two lines decide whether this test ends: the wait and the drop_objection. Every hang in the next section broke one of them.
Five planted hangs: what VCS actually printed
One small bench: a small DUT that passes data through, a driver, a monitor on each side, a scoreboard, and a test whose sequence sends 23 items, 20 of them writes. Each +BUG=N plants one hang. Every run used Synopsys VCS X-2025.06-SP1 with UVM 1.2 on EDA Playground, and the test prints a line of counters when the watchdog fires.
The clean run ended at 305 ns. Every buggy run was stopped by the watchdog at 10,000 ns. Without the watchdog, UVM 1.2 would have waited for its default timeout.
| Run | Objections still raised | clk edges | seq sent | driver done | mon in / out | matched | test waits for | Other clue |
|---|---|---|---|---|---|---|---|---|
| BUG=0 clean | none, ended at 305 ns | 31 | 23 | 23 | 20 / 20 | 20 | 20 | 0 errors |
| BUG=1 objection never dropped | env.bg holds 1 | 1000 | 23 | 23 | 20 / 20 | 20 | 20 | test itself dropped at 305 ns; only bg left |
| BUG=2 no item_done | uvm_test_top holds 1 | 1000 | 6 | 6 | 6 / 6 | 6 | -1 (seq.start never returned) | 495 UVM_ERRORs, “Get_next_item called twice without item_done”, one every 20 ns from 115 ns |
| BUG=3 DUT drops A5 | uvm_test_top holds 1 | 1000 | 23 | 23 | 20 / 19 | 9 | 20 | 10 scoreboard errors, the first one “got ‘h1b, expected ‘ha5”; 'h26 left in the scoreboard |
| BUG=4 clock never starts | uvm_test_top holds 1 | 0 | 0 | 0 | 0 / 0 | 0 | -1 | last bus activity at 0 |
| BUG=5 wrong count | uvm_test_top holds 1 | 1000 | 23 | 23 | 20 / 20 | 20 | 23 | everything matched, nothing missing |
What the table says
- Only BUG=1 is a “stuck objection” in the usual sense. The objection list points straight at
env.bg. - In BUG=2 to BUG=5 the only objection left is the test’s own. The list says who is waiting, not what they are waiting for. The counters answer that.
- BUG=2: the driver kept getting the same idle item back, waited its idle cycles and looped. That is why the error repeats every 2 clocks. The sequence never got past item 7, so
test waits forstayed at -1. - BUG=3 and BUG=5 hang on the same
waitline. In BUG=5 nothing is missing; the test is waiting for 23 when only 20 writes exist. - BUG=3 had a surprise. One dropped byte caused 10 scoreboard errors, because every byte after it was compared one place off. Only 9 of 20 writes matched. And the item left in the scoreboard at the end was
'h26, the last byte, not the lost'hA5. The first error named the real culprit: “got ‘h1b, expected ‘ha5”. Read the first error, not the leftovers. - BUG=4: all zeros, including clk edges. The watchdog still fired because it uses a
#delay, not the clock. A watchdog built on@(posedge clk)would have hung too. - In BUG=1, 3 and 5 the bus went quiet at 305 ns, exactly when the clean run finished. The stimulus was fine. Only the end condition was wrong.
A 5-minute triage for a hung test
The objection list answers “who”. Four counters answer “what”. Put both in every bench, and a hang takes minutes instead of an afternoon.
Step 1. Add a watchdog that doesn’t need the clock. BUG=4 is the reason. With no clock, a watchdog built on @(posedge clk) hangs with everything else. A plain # delay still fires.
// Not simulation-tested: a watchdog in the base test
task run_phase(uvm_phase phase);
fork
begin
#(watchdog_ns * 1ns);
phase.get_objection().display_objections(); // who still holds an objection
print_counters(); // what they are waiting for
`uvm_fatal("WATCHDOG", $sformatf("No end after %0d ns", watchdog_ns))
end
join_none
endtask
Step 2. Read who holds an objection. If it’s a component other than the test, like env.bg in BUG=1, you’ve found it. Look for a raise with no matching drop in that component.
Step 3. If only the test holds one, read the counters. This is where the four other hangs split apart:
| What the counters show | What it means | Run |
|---|---|---|
| clk edges = 0, every counter 0 | The clock or reset never started | BUG=4 |
| “Get_next_item called twice without item_done”, and the test never got past its sequence | The driver skipped item_done() | BUG=2 |
| mon in 20, mon out 19, scoreboard errors starting at one byte | The DUT dropped data | BUG=3 |
| Everything matched, but the test waits for more than was sent | The end condition is wrong | BUG=5 |

Step 4. Turn on +UVM_OBJECTION_TRACE only if steps 2 and 3 didn’t settle it. It prints every raise and drop, which is useful once and loud forever.
Here’s BUG=1 with the trace on. The raise at 0 ns has no matching drop, and the test’s own drop at 305 ns leaves the total at 1:
UVM_INFO @ 0: run [OBJTN_TRC] Object uvm_test_top.env.bg raised 1 objection(s) (background work): count=1 total=1
UVM_INFO @ 0: run [OBJTN_TRC] Object uvm_test_top raised 1 objection(s) (sending stimulus): count=1 total=2
UVM_INFO @ 305: run [OBJTN_TRC] Object uvm_test_top dropped 1 objection(s) (all writes matched): count=0 total=1
The text in brackets is the description you pass to raise_objection() and drop_objection(). Always pass one. It turns the trace into a sentence you can read.
The counters cost about ten lines of code. They turned five identical “WATCHDOG fatal” logs into five different answers.
Common mistakes
Raising an objection inside a monitor or driver loop without a matching drop. The loop never ends, so the objection never drops.
- Fix: leave objections to the test, or to the sequence that knows when stimulus is done.
- Fix: if a component must hold the test open, like a scoreboard with items still queued, raise in
phase_ready_to_end()and drop when the queue is empty.
A watchdog built on the clock. If the clock never starts, the watchdog never fires (BUG=4).
- Fix: use a
#delay in time units, as in Step 1.
Waiting on a count with no way out. wait (matched == N) hangs forever if N is wrong or one item is lost (BUG=3 and BUG=5).
- Fix: wait inside a fork with a timeout, and print expected vs actual when it fires.
- Fix: take N from the sequence (how many it really sent), not from a number typed into the test.
Forgetting item_done() on one path of the driver. Here it was the idle path. The sequence stalls and the log fills with “Get_next_item called twice” (BUG=2).
- Fix: call
item_done()on every path, including early exits and idle items.
The opposite problem: the test ends at 0 ns. Usually nobody raised an objection, or it was raised from a sequence whose starting phase was never set. Raise/Drop objection Automatically with UVM covers that case.
- Fix: raise in the test before
seq.start(), as in the example above.
Leaning on the default timeout. 9200 seconds of simulated time can hold a regression slot for hours.
- Fix: set a per-test limit with
+UVM_TIMEOUToruvm_top.set_timeout(), a little above your longest clean run.
FAQ
Why does my UVM test never end?
Because the run phase still has an objection raised. Either a component raised one and never dropped it, or the test is waiting for an end condition that never comes true. Print the objection list to see who, and print your counters to see what.
How do I see which component is holding an objection?
Call phase.get_objection().display_objections() from a watchdog, or run with +UVM_OBJECTION_TRACE to see every raise and drop.
What is drain time in UVM?
A wait UVM adds after the objection count reaches 0, before the phase ends. It gives data already in flight time to reach the scoreboard. Set it with phase.phase_done.set_drain_time(this, 100ns).
What is the default UVM timeout?
9200 seconds of simulated time in UVM 1.2. Override it with +UVM_TIMEOUT on the command line or uvm_top.set_timeout() in the test.
Do drivers and monitors need objections?
Usually not. The phase ends fine without them. Some teams raise and drop around each transaction so the test can’t end mid-transfer. That works, but it slows a big regression. The real bug is a raise with no matching drop, which is exactly what BUG=1 shows.
What is phase_ready_to_end used for?
It’s the last call before a phase ends. A scoreboard can use it to raise an objection again if items are still queued, then drop it once they’re checked.
Full code
The whole bench in one file: DUT, driver, monitors, scoreboard, the background component and the test. Each +BUG=N plants one hang. On EDA Playground, choose Synopsys VCS and UVM 1.2, set the top module to top, and paste it into testbench.sv.
// test_never_ends_demo.sv : five ways a UVM test never ends, one bench
// The Art of Verification | theartofverification.com
//
// EDA Playground: Synopsys VCS, UVM 1.2, top module "top".
// Paste this whole file into testbench.sv and leave design.sv empty.
//
// Run options (one per run):
// +BUG=0 nothing planted, the test ends on its own
// +BUG=1 a background component raises an objection and never drops it
// +BUG=2 the driver skips item_done() after an idle item
// +BUG=3 the DUT drops the 'hA5 byte
// +BUG=4 the clock never starts
// +BUG=5 the test waits for the wrong count
// Optional: add +UVM_OBJECTION_TRACE to see every raise and drop.
//
// Run on Synopsys VCS X-2025.06-SP1 with UVM 1.2 (EDA Playground), 23 Nov 2026.
`timescale 1ns/1ns
`include "uvm_macros.svh"
import uvm_pkg::*;
int BUG = 0; // set from +BUG=N in the top module
// Counters: printed at the end of a clean run, and when the watchdog fires
class cnt;
static int clk_edges = 0;
static int seq_sent = 0;
static int drv_done = 0;
static int mon_in = 0;
static int mon_out = 0;
static int matched = 0;
static int test_waits = -1; // -1 until the sequence has finished
static time last_activity = 0;
static function string line();
return $sformatf({"clk edges=%0d seq sent=%0d driver done=%0d ",
"mon in=%0d mon out=%0d matched=%0d test waits for=%0d ",
"last bus activity at %0t"},
clk_edges, seq_sent, drv_done, mon_in, mon_out,
matched, test_waits, last_activity);
endfunction
endclass
// Interface and DUT: a one-stage pipeline that passes bytes through
interface bus_if (input logic clk);
logic rst_n;
logic in_valid;
logic [7:0] in_data;
logic out_valid;
logic [7:0] out_data;
endinterface
module dut (bus_if b);
always_ff @(posedge b.clk or negedge b.rst_n)
if (!b.rst_n) begin
b.out_valid <= 1'b0;
b.out_data <= '0;
end else begin
// BUG=3: the 'hA5 byte goes in but never comes out
b.out_valid <= b.in_valid && !(BUG == 3 && b.in_data == 8'hA5);
b.out_data <= b.in_data;
end
endmodule
// Sequence item and sequence: 23 items, 20 writes and 3 idle items
class bus_item extends uvm_sequence_item;
bit idle;
bit [7:0] data;
int idle_cycles = 2;
`uvm_object_utils(bus_item)
function new(string name = "bus_item");
super.new(name);
endfunction
endclass
class bus_seq extends uvm_sequence #(bus_item);
`uvm_object_utils(bus_seq)
int num_items = 23;
int num_writes = 0;
function new(string name = "bus_seq");
super.new(name);
endfunction
task body();
for (int i = 0; i < num_items; i++) begin
req = bus_item::type_id::create($sformatf("item%0d", i));
start_item(req);
req.idle = (i == 6 || i == 13 || i == 20); // items 7, 14 and 21 are idle
req.data = (i == 10) ? 8'hA5 : 8'h10 + i[7:0]; // item 11 carries 'hA5
finish_item(req);
cnt::seq_sent++;
if (!req.idle) num_writes++;
end
endtask
endclass
// Driver
class bus_driver extends uvm_driver #(bus_item);
`uvm_component_utils(bus_driver)
virtual bus_if vif;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
task run_phase(uvm_phase phase);
vif.in_valid <= 1'b0;
vif.in_data <= '0;
@(posedge vif.rst_n);
@(posedge vif.clk);
forever begin
seq_item_port.get_next_item(req);
if (req.idle) begin
vif.in_valid <= 1'b0;
repeat (req.idle_cycles) @(posedge vif.clk);
if (BUG == 2) continue; // BUG=2: item_done() forgotten on the idle path
end else begin
vif.in_valid <= 1'b1;
vif.in_data <= req.data;
@(posedge vif.clk);
vif.in_valid <= 1'b0;
end
seq_item_port.item_done();
cnt::drv_done++;
end
endtask
endclass
// Monitors: one on the input side, one on the output side
class mon_in extends uvm_monitor;
`uvm_component_utils(mon_in)
virtual bus_if vif;
uvm_analysis_port #(bus_item) ap;
function new(string name, uvm_component parent);
super.new(name, parent);
ap = new("ap", this);
endfunction
task run_phase(uvm_phase phase);
forever begin
@(posedge vif.clk);
if (vif.rst_n && vif.in_valid) begin
bus_item t = bus_item::type_id::create("t");
t.data = vif.in_data;
cnt::mon_in++;
cnt::last_activity = $time;
ap.write(t);
end
end
endtask
endclass
class mon_out extends uvm_monitor;
`uvm_component_utils(mon_out)
virtual bus_if vif;
uvm_analysis_port #(bus_item) ap;
function new(string name, uvm_component parent);
super.new(name, parent);
ap = new("ap", this);
endfunction
task run_phase(uvm_phase phase);
forever begin
@(posedge vif.clk);
if (vif.rst_n && vif.out_valid) begin
bus_item t = bus_item::type_id::create("t");
t.data = vif.out_data;
cnt::mon_out++;
cnt::last_activity = $time;
ap.write(t);
end
end
endtask
endclass
// Scoreboard: in-order compare
`uvm_analysis_imp_decl(_in)
`uvm_analysis_imp_decl(_out)
class bus_sb extends uvm_scoreboard;
`uvm_component_utils(bus_sb)
uvm_analysis_imp_in #(bus_item, bus_sb) in_imp;
uvm_analysis_imp_out #(bus_item, bus_sb) out_imp;
bit [7:0] expected[$];
function new(string name, uvm_component parent);
super.new(name, parent);
in_imp = new("in_imp", this);
out_imp = new("out_imp", this);
endfunction
function void write_in(bus_item t);
expected.push_back(t.data);
endfunction
function void write_out(bus_item t);
bit [7:0] exp;
if (expected.size() == 0) begin
`uvm_error("SB", $sformatf("got 'h%02h with nothing expected", t.data))
return;
end
exp = expected.pop_front();
if (t.data !== exp)
`uvm_error("SB", $sformatf("got 'h%02h, expected 'h%02h", t.data, exp))
else
cnt::matched++;
endfunction
function string pending();
string s = "";
foreach (expected[i]) s = {s, $sformatf(" 'h%02h", expected[i])};
return (s == "") ? " nothing" : s;
endfunction
endclass
// A component that should never hold the test open
class bg_comp extends uvm_component;
`uvm_component_utils(bg_comp)
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
task run_phase(uvm_phase phase);
if (BUG == 1) phase.raise_objection(this, "background work"); // BUG=1: never dropped
endtask
endclass
// Env
class bus_env extends uvm_env;
`uvm_component_utils(bus_env)
uvm_sequencer #(bus_item) sqr;
bus_driver drv;
mon_in min;
mon_out mout;
bus_sb sb;
bg_comp bg;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
virtual bus_if vif;
if (!uvm_config_db#(virtual bus_if)::get(this, "", "vif", vif))
`uvm_fatal("NOVIF", "bus_if not set")
sqr = uvm_sequencer#(bus_item)::type_id::create("sqr", this);
drv = bus_driver::type_id::create("drv", this);
min = mon_in::type_id::create("min", this);
mout = mon_out::type_id::create("mout", this);
sb = bus_sb::type_id::create("sb", this);
bg = bg_comp::type_id::create("bg", this);
drv.vif = vif; min.vif = vif; mout.vif = vif;
endfunction
function void connect_phase(uvm_phase phase);
drv.seq_item_port.connect(sqr.seq_item_export);
min.ap.connect(sb.in_imp);
mout.ap.connect(sb.out_imp);
endfunction
endclass
// Test
class never_ends_test extends uvm_test;
`uvm_component_utils(never_ends_test)
bus_env env;
int watchdog_ns = 10000;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
env = bus_env::type_id::create("env", this);
endfunction
task run_phase(uvm_phase phase);
bus_seq seq = bus_seq::type_id::create("seq");
// Watchdog on a # delay, not on the clock, so it fires even with no clock
fork
begin
#(watchdog_ns * 1ns);
phase.get_objection().display_objections();
`uvm_info("COUNTERS", cnt::line(), UVM_NONE)
`uvm_info("COUNTERS", {"scoreboard still expects:", env.sb.pending()}, UVM_NONE)
`uvm_fatal("WATCHDOG", $sformatf("No end after %0d ns", watchdog_ns))
end
join_none
phase.raise_objection(this, "sending stimulus");
seq.start(env.sqr);
// BUG=5: waits for every item sent, idle items included, instead of the writes
cnt::test_waits = (BUG == 5) ? seq.num_items : seq.num_writes;
wait (cnt::matched == cnt::test_waits);
phase.drop_objection(this, "all writes matched");
endtask
function void report_phase(uvm_phase phase);
`uvm_info("END", cnt::line(), UVM_NONE)
endfunction
endclass
// Top
module top;
logic clk = 1'b0;
bus_if b (clk);
dut u_dut (b);
always @(posedge clk) cnt::clk_edges++;
// One initial block, so BUG is set before anything else reads it
initial begin
void'($value$plusargs("BUG=%d", BUG));
`uvm_info("TOP", $sformatf("Running with BUG=%0d", BUG), UVM_NONE)
b.rst_n = 1'b0;
fork
if (BUG != 4) forever #5 clk = ~clk; // BUG=4: the clock never starts
#25 b.rst_n = 1'b1; // a # delay, so reset releases with no clock
join_none
uvm_config_db#(virtual bus_if)::set(null, "uvm_test_top.env", "vif", b);
run_test("never_ends_test");
end
endmodule
References and read next
References
- Accellera UVM downloads and class reference
- IEEE 1800.2 standard for UVM (the hangs in this article ran on UVM 1.2)
Read next
- UVM Scoreboard Mismatch: How to Find the Real Cause
- The Practical Verification Debug Guide
- UVM phasing
- How to terminate a UVM test: objections
- Raise and drop objections automatically

One Comment