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

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • 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 Event Never Triggered
    • 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
  • Interview Prep: Puzzle Rounds5
  • 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. Handshake Violation: item_done Called Twice

VLSI DV Interview Puzzles · All levels

Handshake Violation: item_done Called Twice

Test sometimes fatals with sequencer protocol error, and sometimes appears to hang after retries. Find the handshake bug introduced in retry handling.

On this page

    Puzzle

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

    Test sometimes fatals with sequencer protocol error, and sometimes appears to hang after retries. Find the handshake bug introduced in retry handling.

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    virtual task run_phase(uvm_phase phase);
      my_item req;
      forever begin
        seq_item_port.get_next_item(req);
        drive_req(req);
        if (req.retry) begin
          seq_item_port.item_done();
        end
        seq_item_port.item_done(); // second done on retry path
      end
    endtask

    Hint

    Count handshakes by transaction id: grant, get, done.

    Step-by-step solution

    Diagram
    1) Enable protocol checkers/logging around sequencer handshake API calls.
    2) Trigger a retry case and observe two item_done calls for one get_next_item.
    3) See queue bookkeeping corruption that later manifests as stall/fatal.
    4) Refactor to exactly one item_done at a single exit point.
    5) Add a unit test for retry path to prevent regression.

    Answer

    Answer: Bug: retry path calls item_done twice for one granted item. Fix: centralize handshake completion so each request has exactly one item_done.

    Why candidates get it wrong

    A quick workaround that removes retry behavior can hide the protocol violation but break functionality.

    Interviewer follow-up

    Would you use assertions, sequencer callbacks, or counters to enforce one-to-one handshake pairing?

    Related topics

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

    • Scenario & Debug Puzzles section

    Previous

    183 / 210

    Next: Sequence get_response Stall

    Up next

    Up nextSequence get_response Stall

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Handshake Hang: Missing item_done on One Branch
    • Missing run_phase Objection in Test
    • Virtual Sequence Waits on Event Never Triggered