Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • Study Route: One Week Before the Interview
  • Study Route: Two Weeks
  • Study Route: Four Weeks (Full Course)4
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
    • Testbench Debug Puzzles: Why Did the Test Hang?
      • Handshake Hang: Missing item_done on One Branch
      • Missing run_phase Objection in Test
      • Wrong Phase: Starting Traffic in shutdown_phase
      • Handshake Violation: item_done Called Twice
      • Sequence get_response Stall
      • Virtual Sequence Waits on an Event That Already Fired
    • Deadlock Scenario Puzzles: Objection and Phase Stalls
    • Scoreboard Puzzles: Mismatch or Ordering Bug?
    • Real Interview Rounds: End-to-End Debug Walkthrough
    • Scenario & Debug Puzzles: Tricky Q&A
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←Testbench Debug Puzzles: Why Did the Test Hang?
  1. Topics
  2. DV Interview Puzzles
  3. Scenario & Debug Puzzles
  4. Testbench Debug Puzzles: Why Did the Test Hang?
  5. Virtual Sequence Waits on an Event That Already Fired
On this page

    VLSI DV Interview PuzzlesAll levels

    Virtual Sequence Waits on an Event That Already Fired

    A virtual sequence hangs after all traffic. The environment wiring has been verified: the monitor's analysis port is connected to the scoreboard instance the vseq watches, and the log shows the scoreboard did trigger its event. Log tail: UVM_INFO @ 8120ns [SB] all 64 items checked, triggering done_ev UVM_INFO @ 8130ns [VSEQ] start_subseqs returned, waiting for done_ev (no further messages; objection never dropped) Why is the vseq still blocked?

    Puzzle

    Difficulty: Medium · Puzzle 6 of 6 · Topic: Testbench Debug Puzzles: Why Did the Test Hang?

    A virtual sequence hangs after all traffic. The environment wiring has been verified: the monitor's analysis port is connected to the scoreboard instance the vseq watches, and the log shows the scoreboard did trigger its event. Log tail: UVM_INFO @ 8120ns [SB] all 64 items checked, triggering done_ev UVM_INFO @ 8130ns [VSEQ] start_subseqs returned, waiting for done_ev (no further messages; objection never dropped) Why is the vseq still blocked?

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    class scoreboard extends uvm_scoreboard;
      event done_ev;
      int   checked, expected_n = 64;
      function void write_rsp(rsp_t r);
        // ... compare ...
        if (++checked == expected_n) begin
          \`uvm_info("SB", "all 64 items checked, triggering done_ev", UVM_LOW)
          -> done_ev;
        end
      endfunction
    endclass
    
    class top_vseq extends uvm_sequence;
      virtual task body();
        start_subseqs();                        // runs the traffic sequences to completion
        \`uvm_info("VSEQ", "start_subseqs returned, waiting for done_ev", UVM_LOW)
        @(p_sequencer.env.sb.done_ev);          // hangs
      endtask
    endclass

    Hint

    Compare the time the event was triggered with the time the wait started.

    Step-by-step solution

    Diagram
    1) Rule out wiring first: print sb.get_full_name() in write_rsp and in the vseq, and the checked counter; here they match, and the scoreboard really did trigger done_ev.
    2) Compare timestamps: the trigger at 8120ns is before the wait begins at 8130ns.
    3) @(event) is edge-sensitive: it only wakes for a trigger that happens after the wait starts. A trigger that already fired is lost (verified in simulation).
    4) Fix: use a sticky condition. Either a flag with wait(sb.all_done), or a uvm_event with wait_on() (returns immediately if the event is already on), or check the counter before waiting.
    5) Add an assertion that the vseq end condition cannot be missed: after the wait, check checked == expected_n.

    Answer

    Answer: Bug: the scoreboard triggers a plain SystemVerilog event before the vseq starts waiting on it; @(event) misses a trigger that has already happened. Fix: make the condition sticky (flag + wait(), or uvm_event::wait_on()) instead of an edge-sensitive event.

    How this was checked

    Checked by running the code in Verilator 5 and Icarus Verilog 13; the printed output supports the answer above. Plain SV shows an @(event) wait misses a trigger that already fired, while a sticky flag does not; uvm_event itself is not run. Plain SV shows an @(event) wait misses a trigger that already fired, while a sticky flag does not; uvm_event itself is not run.

    Why candidates get it wrong

    Candidates blame TLM wiring because that is the usual cause, but the log here proves the trigger happened; the bug is the ordering between trigger and wait.

    Interviewer follow-up

    How would you automatically validate critical TLM connections during build/connect, so wiring bugs are caught before simulation? Model answer: In end_of_elaboration_phase (or check at start_of_simulation) assert that each analysis port has the expected number of subscribers (ap.size() and the connected imp paths), and at end of test fail if a scoreboard that should have seen traffic saw zero items.

    Say it out loud

    The log proves the trigger happened, so I do not blame the TLM wiring and look at the order of trigger and wait instead. The root cause is that the scoreboard triggers a plain SystemVerilog event before the virtual sequence starts waiting, and an edge-sensitive wait misses a trigger that already happened. I confirm it by comparing the trigger and wait timestamps. The fix is to make the condition sticky, with a flag and wait, or uvm_event wait_on.

    Related topics

    • The Coordination Problem

    • Back to Testbench Debug Puzzles: Why Did the Test Hang?

    • Scenario & Debug Puzzles section

    Previous

    191 / 293

    Next: Deadlock Scenario Puzzles: Objection and Phase Stalls

    Up next

    Up nextDeadlock Scenario Puzzles: Objection and Phase Stalls

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Handshake Hang: Missing item_done on One Branch
    • Missing run_phase Objection in Test
    • Wrong Phase: Starting Traffic in shutdown_phase