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
    • Race Condition Puzzles
      • Competing Active Writers on x
      • Blocking Writer vs NBA Writer Same Signal
      • False Mismatch from Active Sampling
      • #0 Monitor Is Still Before NBA
      • Lost Update in Forked Counter
      • Two always_ff Writers, One Register
    • 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

‹Race Condition Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Concurrency & Timing Puzzles
  4. Race Condition Puzzles
  5. False Mismatch from Active Sampling

VLSI DV Interview Puzzles · All levels

False Mismatch from Active Sampling

The monitor reports mismatch even though RTL is correct. Explain the race and first mismatch time.

On this page

    Puzzle

    Difficulty: Easy · Puzzle 3 of 6 · Topic: Race Condition Puzzles

    The monitor reports mismatch even though RTL is correct. Explain the race and first mismatch time.

    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;
      bit d = 1;
      bit q = 0;
      always #5 clk = ~clk;
    
      always @(posedge clk) q <= d;
    
      always @(posedge clk) begin
        if (q !== d)
          $display("[%0t] mismatch q=%0b d=%0b", $time, q, d);
      end
    
      initial begin
        repeat (2) @(posedge clk);
        $finish;
      end
    endmodule

    Hint

    Both always blocks run in active; q update is deferred to NBA.

    Step-by-step solution

    Diagram
    1) At t=5, q is still 0 in active while d=1, so monitor flags mismatch.
    2) q<=d commits in NBA later in same slot, making q=1 after monitor already checked.
    3) This is a sampling race in monitor placement, not a DUT bug.

    Answer

    Answer: First mismatch appears at t=5 because monitor samples old q in active before NBA update.

    Why candidates get it wrong

    Candidates often blame DUT sequential logic instead of monitor region placement.

    Interviewer follow-up

    Would using a clocking block input #0 or $strobe-based check remove this false failure?

    Related topics

    • Back to Race Condition Puzzles

    • Concurrency & Timing Puzzles section

    Previous

    63 / 210

    Next: #0 Monitor Is Still Before NBA

    Up next

    Up next#0 Monitor Is Still Before NBA

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Competing Active Writers on x
    • Lost Update in Forked Counter
    • Two always_ff Writers, One Register