VLSI DV Interview Puzzles · All levels
Handshake Hang: Missing item_done on One Branch
Regression hangs in 3/200 seeds. Last log says the sequence is blocked in finish_item(). Find the exact liveness bug and fix it without changing stimulus intent.
Puzzle
Difficulty: Medium · Puzzle 1 of 6 · Topic: Testbench Debug Puzzles: Why Did the Test Hang?
Regression hangs in 3/200 seeds. Last log says the sequence is blocked in finish_item(). Find the exact liveness bug and fix it without changing stimulus intent.
Code
class req_seq extends uvm_sequence #(my_item);
\`uvm_object_utils(req_seq)
virtual task body();
my_item req;
repeat (100) begin
req = my_item::type_id::create("req");
start_item(req);
assert(req.randomize());
finish_item(req);
end
endtask
endclass
class my_driver extends uvm_driver #(my_item);
\`uvm_component_utils(my_driver)
virtual task run_phase(uvm_phase phase);
my_item req;
forever begin
seq_item_port.get_next_item(req);
if (req.addr[0]) begin
continue; // bug
end
drive_req(req);
seq_item_port.item_done();
end
endtask
endclassHint
Audit get_next_item/item_done pairing on every control-flow path, not just the common path.
Step-by-step solution
1) Reproduce with one seed and add driver logs around get_next_item/item_done including txn id.
2) Observe iterations where req.addr[0] is 1 and code executes continue before item_done.
3) Confirm sequencer waits forever because one request handshake is never closed.
4) Refactor to call item_done exactly once for every get_next_item regardless of branching.
5) Add an assertion or counter check that outstanding requests return to zero at end-of-test.Answer
Answer: Bug: early continue skips item_done, so finish_item blocks. Fix: ensure one item_done per get_next_item in all branches (including error/skip branches).
Why candidates get it wrong
Teams often increase timeout first, masking the protocol-liveness bug and wasting debug cycles.
Interviewer follow-up
How would you instrument sequencer-driver latency so this class of bug is caught within 100 cycles?