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
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
    • Reset Puzzles
    • Clock Gating & Clock Mux Puzzles
    • CDC Basics Puzzles
      • MTBF Of Two Flops Versus Three
      • Back-to-Back Events Through a Toggle Synchroniser
      • Why Gray Code Across Clock Domains
      • A Four-Phase Handshake For a Bus
      • Full or Not in a Gray-Coded FIFO
      • Valid Crossed, Data Did Not
    • Verifying CDC & Reset Puzzles
    • Clock, Reset & CDC Puzzles: Tricky Q&A
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←CDC Basics Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Clock, Reset & CDC Puzzles
  4. CDC Basics Puzzles
  5. Valid Crossed, Data Did Not
On this page

    VLSI DV Interview PuzzlesAll levels

    Valid Crossed, Data Did Not

    A source puts a word on a bus that changes every source clock (a live counter) and raises valid while the bus holds A3. Only valid is synchronised into the destination; when the destination sees valid it reads the bus. What does the destination read, and what fixes it?

    Puzzle

    Difficulty: Easy · Puzzle 6 of 6 · Topic: CDC Basics Puzzles

    A source puts a word on a bus that changes every source clock (a live counter) and raises valid while the bus holds A3. Only valid is synchronised into the destination; when the destination sees valid it reads the bus. What does the destination read, and what fixes it?

    Code

    tb.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    `timescale 1ns/1ns
    module tb;
      reg clks = 0, clkd = 0;
      always #5  clks = ~clks;                    // source period 10: posedges at 5, 15, 25, ...
      always #12 clkd = ~clkd;                    // destination period 24: posedges at 12, 36, 60, 84, ...
      reg [7:0] data = 8'hA0;
      reg valid = 0;
      always @(posedge clks) data <= data + 1;    // the bus is a live counter, it moves every source cycle
      reg v1 = 0, v2 = 0, v3 = 0;
      always @(posedge clkd) begin
        v1 <= valid; v2 <= v1; v3 <= v2;          // only valid is synchronised
        if (v2 && !v3) $display("t=%0d dst sees valid, bus=%h", $time, data);
      end
      initial begin
        #26 $display("t=%0d src raises valid, bus=%h", $time, data);
        valid = 1;                                // bus holds a3 from t=25 to t=35
        #40 valid = 0;                            // valid stays up for 4 source cycles
        #30 $finish;
      end
    endmodule

    Hint

    How many source cycles pass before the destination sees valid?

    Step-by-step solution

    Diagram
    1) The bus holds A3 from t=25 to t=35. valid is raised at t=26.
    2) valid goes through two destination flops: the destination clock edge at t=36 gives v1, t=60 gives v2, and the edge at t=84 is the first at which v2 is high and v3 low.
    3) At t=84 the destination reads the bus. By then the live counter has advanced from A3 to A8 (it moves at every source edge).
    4) The word it reads (A8) is not the word that was valid (A3): the control crossed, the data did not.
    5) Fix: hold the data in a register that does not change while the valid / handshake is in flight and read it only after the synchronised request, or use a FIFO, or a handshake.

    Answer

    Answer: The destination reads A8, not A3, at t=84. Synchronising the control signal does not synchronise the data; the data must be held stable until the destination has used it (handshake, held register, or FIFO).

    How this was checked

    Checked by running the code in Icarus Verilog 13; the printed output supports the answer above. Icarus: the destination reads a later word of the live bus than the one that was valid.

    Why candidates get it wrong

    Thinking a synchronised valid makes the data 'valid' on the other side. The data is not held for the several cycles the control needs to cross; even though no bit is metastable, it is a different word. The same problem exists when two related signals each cross through their own two-flop synchroniser.

    Interviewer follow-up

    What changes if the destination clock were much faster than the source clock? Model answer: the data would still have advanced by the delay of the synchroniser, which is a fixed number of destination cycles, so with a faster destination it could be fewer source cycles; but nothing guarantees it, so the same fix is required.

    Related topics

    • Back to CDC Basics Puzzles

    • Clock, Reset & CDC Puzzles section

    Previous

    253 / 293

    Next: Verifying CDC & Reset Puzzles

    Up next

    Up nextVerifying CDC & Reset Puzzles

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • MTBF Of Two Flops Versus Three
    • Back-to-Back Events Through a Toggle Synchroniser
    • Why Gray Code Across Clock Domains