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
    • Event Scheduling Puzzles
      • Assertion Samples Preponed Values
      • Does #0 Beat NBA?
      • Trigger Then Wait: The Missed Event
      • Program Drive Is Seen One Edge Later
      • Last NBA in a Process Wins
      • Assertion Action Block Cannot Rewind Edge
    • Race Condition Puzzles
    • Clocking Block Puzzles
    • Semaphore & Mailbox Puzzles
    • Concurrency & Timing Puzzles: Tricky Q&A
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←Event Scheduling Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Concurrency & Timing Puzzles
  4. Event Scheduling Puzzles
  5. Does #0 Beat NBA?
On this page

    VLSI DV Interview PuzzlesAll levels

    Does #0 Beat NBA?

    Predict both prints at time 0 and explain why they differ even though there is no real time advance.

    Puzzle

    Difficulty: Easy · Puzzle 2 of 6 · Topic: Event Scheduling Puzzles

    Predict both prints at time 0 and explain why they differ even though there is no real time advance.

    Code

    tb.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    module tb;
      int x;
      initial begin
        x = 0;
        x <= 1;
        #0 x = 2;
        $display("[%0t INACTIVE] x=%0d", $time, x);
        $strobe("[%0t POSTPONED] x=%0d", $time, x);
      end
    endmodule

    Hint

    #0 lands in inactive; NBA updates happen after inactive.

    Step-by-step solution

    Diagram
    1) Active region schedules x<=1 for NBA.
    2) #0 resumes in inactive and assigns x=2.
    3) $display in inactive prints x=2 at t=0.
    4) NBA region then updates x to 1.
    5) $strobe runs in postponed and prints x=1 at t=0.

    Answer

    Answer: Inactive print is [0] x=2, postponed print is [0] x=1. #0 executes before NBA in the same time slot.

    How this was checked

    Checked by running the code in Icarus Verilog 13 and Verilator 5; the printed output supports the answer above. LRM 4.4: #0 resumes in the Inactive region, before the NBA, so the strobe prints x=1. Verilator 5.048 completes the NBA before the #0 resumes (it does not model the Inactive region) and prints x=2; the LRM answer is x=1.

    Why candidates get it wrong

    Many engineers think #0 moves after NBA because it 'feels later'. It does not.

    Interviewer follow-up

    If you replace #0 with #1, what changes in ordering and printed time?

    Say it out loud

    At time zero the #0 resumes in the Inactive region, which comes before the NBA region, so the display prints x equal to 2. The NBA then sets x to 1, and the strobe in Postponed prints 1. The trap is thinking that #0 moves you after the NBA because it feels later. I would also mention that Verilator completes the NBA first and prints 2 for the strobe, so I would trust the LRM and an event-driven simulator here, not that one.

    Related topics

    • The Event Scheduler & Stratified Regions

    • Scheduling Regions: the Full Map

    • Back to Event Scheduling Puzzles

    • Concurrency & Timing Puzzles section

    Previous

    62 / 293

    Next: Trigger Then Wait: The Missed Event

    Up next

    Up nextTrigger Then Wait: The Missed Event

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Program Drive Is Seen One Edge Later
    • Last NBA in a Process Wins
    • Assertion Action Block Cannot Rewind Edge