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
    • Event Scheduling Puzzles
      • Observed Assertion Sees Previous Cycle
      • Does #0 Beat NBA?
      • Chained #0 Delays vs Single NBA
      • Program Reactive Drive Lag
      • 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
  • Interview Prep: Puzzle Rounds5
  • DV Puzzle Cheatsheet
Loading lesson

‹Event Scheduling Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Concurrency & Timing Puzzles
  4. Event Scheduling Puzzles
  5. Last NBA in a Process Wins

VLSI DV Interview Puzzles · All levels

Last NBA in a Process Wins

Predict active print and end-of-slot value of q on the first edge. Explain why only one NBA survives.

On this page

    Puzzle

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

    Predict active print and end-of-slot value of q on the first edge. Explain why only one NBA survives.

    Code

    tb.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    module tb;
      bit clk = 0;
      int q = 0;
      always #5 clk = ~clk;
    
      always @(posedge clk) begin
        q <= 1;
        q <= 2;
        q <= 3;
        $display("[%0t ACTIVE] q=%0d", $time, q);
      end
    
      initial begin
        @(posedge clk);
        $strobe("[%0t POSTPONED] q=%0d", $time, q);
        $finish;
      end
    endmodule

    Hint

    Within one process and one time slot, later NBA to same variable overrides earlier NBA updates.

    Step-by-step solution

    Diagram
    1) Active print sees old q=0 at t=5.
    2) Three NBAs are queued for q in same process.
    3) Last assignment q<=3 overrides earlier q<=1 and q<=2 for that slot.
    4) Postponed print shows q=3 at t=5.

    Answer

    Answer: Active shows q=0 at t=5; final value is q=3 at t=5. Last NBA to same variable in the process wins.

    Why candidates get it wrong

    People mix this with cross-process NBA ordering, which is not guaranteed.

    Interviewer follow-up

    What if each q<= assignment were in separate always blocks on the same edge?

    Related topics

    • Back to Event Scheduling Puzzles

    • Concurrency & Timing Puzzles section

    Previous

    59 / 210

    Next: Assertion Action Block Cannot Rewind Edge

    Up next

    Up nextAssertion Action Block Cannot Rewind Edge

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Observed Assertion Sees Previous Cycle
    • Does #0 Beat NBA?
    • Chained #0 Delays vs Single NBA