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
    • Clocking Block Puzzles
      • Why First Sample Sees Old grant
      • Interpreting |=> ##1 in Clocking Domain
      • output #1step Misses Current Edge
      • input #0 vs input #1step Snapshot
      • Raw @posedge Monitor vs @(cb) Monitor
      • Mixing Direct Drive and cb Drive
    • 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

‹Clocking Block Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Concurrency & Timing Puzzles
  4. Clocking Block Puzzles
  5. Why First Sample Sees Old grant

VLSI DV Interview Puzzles · All levels

Why First Sample Sees Old grant

Explain the two displayed grant values and why the first sample is stale despite driving req in the same cycle.

On this page

    Puzzle

    Difficulty: Medium · Puzzle 1 of 6 · Topic: Clocking Block Puzzles

    Explain the two displayed grant values and why the first sample is stale despite driving req in the same cycle.

    Code

    arb_if.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    interface arb_if(input bit clk);
      logic req, grant;
      clocking cb @(posedge clk);
        default input #1step output #0;
        input grant;
        output req;
      endclocking
    endinterface
    
    module tb;
      bit clk = 0;
      arb_if vif(clk);
      always #5 clk = ~clk;
    
      always @(posedge clk)
        vif.grant <= vif.req;
    
      initial begin
        vif.req = 0;
        @(vif.cb);
        vif.cb.req <= 1;
        $display("[%0t] cb.grant=%0b", $time, vif.cb.grant);
        @(vif.cb);
        $display("[%0t] cb.grant=%0b", $time, vif.cb.grant);
        $finish;
      end
    endmodule

    Hint

    input #1step samples before the edge; output #0 drives at event edge.

    Step-by-step solution

    Diagram
    1) First @(vif.cb) samples grant from just before the edge, still old 0.
    2) req drive via cb output #0 happens at that edge.
    3) DUT updates grant<=req in NBA for that edge.
    4) Next @(vif.cb) then samples updated grant=1.

    Answer

    Answer: First print is grant=0 at t=5, second print is grant=1 at t=15. Sampling and driving are intentionally offset by skew.

    Why candidates get it wrong

    Treating cb sampling and driving as a single atomic action leads to off-by-one-cycle errors.

    Interviewer follow-up

    If input skew changed to #0, how would the first sampled grant change?

    Related topics

    • Back to Clocking Block Puzzles

    • Concurrency & Timing Puzzles section

    Previous

    67 / 210

    Next: Interpreting |=> ##1 in Clocking Domain

    Up next

    Up nextInterpreting |=> ##1 in Clocking Domain

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • output #1step Misses Current Edge
    • input #0 vs input #1step Snapshot
    • Raw @posedge Monitor vs @(cb) Monitor