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 Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
    • Common-Clock Interfaces
    • Asynchronous Serial and Oversampling
    • Source-Synchronous Clocks and Strobes
    • Embedded Clocks and Clock Recovery
    • Skew and Deskew
    • Clock Relationships
    • Elastic Buffers and Clock Compensation
    • Self-Timed Handshakes
    • Crossing at the Interface
    • Protocols Compared: Timing and Clocking
    • Drills: Timing and Clocking
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 1: Timing and Clocking
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 1: Timing and Clocking
  4. Source-Synchronous Clocks and Strobes

Part 1 · Timing and Clocking · Working (W)

Source-Synchronous Clocks and Strobes

Send a clock or strobe alongside the data so both suffer the same wire delay. Edge-aligned versus centre-aligned strobes, and double data rate.

On this page

    Note

    Level: Working (W) · Answers: When is the data valid?

    Before this: Common-Clock Interfaces

    A memory interface must move data at well over a gigabit per second per pin across a few centimetres of board. A common clock cannot do it: the flight time alone is a large part of a bit. Yet the same board carries the same signals at those rates every day.

    How do you capture data reliably when the trip across the board takes longer than the data stays valid?

    The obvious answer, and why it breaks

    The common-clock budget puts the full flight time inside the clock period (lesson 1.1). The natural first fix is to make the trip shorter or the clock slower, and neither scales: chips cannot move closer, and slower clocks defeat the purpose. A cleverer fix is to delay the receiver's clock by the flight time so it lines up with the arriving data. That works for one board at one temperature, but flight time varies with board, load and temperature, and the receiver has no way to know by how much.

    The idea: send the timing with the data

    Instead of guessing the delay, make the timing reference suffer the same delay as the data. The transmitter sends a clock or a strobe on a wire routed right next to the data wires. Whatever the board does to the data, it does almost the same to the strobe, so at the receiver they arrive together. The flight time drops out of the budget; only the mismatch between the strobe wire and the data wires remains, and careful routing keeps that small. This is a source-synchronous interface: the source sends its own clock.

    Two refinements follow:

    • Double data rate (DDR). Data changes on both edges of the strobe, so each strobe cycle carries two bits per wire. The strobe toggles only as fast as one bit per edge, which halves its frequency for a given data rate.

    • Edge-aligned or centre-aligned. If the data changes at the same moment as the strobe edges (edge-aligned), the receiver cannot sample on those edges: it would catch data in transition. It must shift the strobe by a quarter of its period (90 degrees), so each edge lands in the middle of a bit. If the transmitter already places the strobe edges in the middle of the bits (centre-aligned), the receiver can use them directly.

    The transmitter launches data and strobe together; the board delays both alike; the receiver shifts the strobe to mid-bit and samples on both of its edges.

    Build it: capture on both edges of a shifted strobe

    The testbench sends six bytes on dq, changing on both edges of dqs (edge-aligned, as a memory does on reads). The receiver delays the strobe by a quarter of its period to make dqs_90, and captures dq on both of its edges. The waveform is sampled with a fast 5 ns clock so the quarter-period shift is visible; that clock is for viewing only and plays no part in the capture.

    tb.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
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    `timescale 1ns/100ps
    // Source-synchronous double data rate: the transmitter sends a strobe (dqs) with the
    // data (dq), and dq changes on both edges of dqs. As sent, dq is edge-aligned with dqs:
    // it changes exactly when dqs does, so dqs cannot sample it directly. The receiver
    // delays the strobe by a quarter of its period (dqs_90), which puts each strobe edge in
    // the middle of a data bit, and captures dq on both edges of the delayed strobe.
    // The waveform is sampled with a fast clock (5 ns) so the quarter-period shift is visible.
    module tb;
      localparam real T = 40.0;            // strobe period: one data bit every T/2 = 20 ns
      logic sclk = 0;                      // sampling clock for the waveform only
      always #2.5 sclk = ~sclk;
    
      logic       dqs = 0;
      wire        dqs_90;
      logic [7:0] dq = 8'h00;
      logic [7:0] tx [0:5] = '{8'h11, 8'h22, 8'h33, 8'h44, 8'h55, 8'h66};
    
      // Transmitter: strobe and data change together (edge-aligned).
      initial begin
        #20;
        for (int i = 0; i < 6; i++) begin
          dq = tx[i]; dqs = ~dqs;
          #(T/2);
        end
        dq = 8'h00;
      end
    
      // Receiver: delay the strobe by a quarter period (90 degrees).
      assign #(T/4) dqs_90 = dqs;
    
      // Capture on both edges of the delayed strobe, once the transmitter has started
      // (the delayed wire's settling from X at time zero is not a strobe edge).
      logic armed = 0;
      initial @(posedge dqs) armed = 1;
      logic [7:0] rx [0:5]; int n = 0;
      always @(dqs_90) if (armed && n < 6) begin rx[n] = dq; n++; end
    
      initial begin
        $dumpfile("wave.vcd"); $dumpvars(0, tb);
        #200;
        for (int i = 0; i < 6; i++) if (rx[i] !== tx[i]) begin
          $display("FAIL: word %0d captured %h, sent %h", i, rx[i], tx[i]); $finish;
        end
        $display("PASS: six words captured mid-bit on both edges of the delayed strobe");
        $finish;
      end
    endmodule

    Watch it run

    How to read it, slot by slot:

    • Slot 1: dqs rises and dq changes to 11 at the same moment: edge-aligned. Sampling on this edge would catch the transition.

    • Slot 3: dqs_90 rises, a quarter period (10 ns, two slots) later, in the middle of the four slots that carry 11. The receiver captures 11 here.

    • Slot 5: dqs falls and dq changes to 22; slot 7: dqs_90 falls in the middle of 22, and the receiver captures it on this falling edge. Both edges carry data: double data rate.

    • Slots 9 to 23: the pattern repeats for 33 to 66. Every capture edge sits two slots from the nearest data change on either side, the most margin the bit allows.

    Worked numbers: what is left in the budget

    With illustrative numbers, compare the two schemes for a link carrying 1.6 Gb/s per pin (625 ps per bit) over 50 mm of trace:

    Diagram
    Common clock:       flight time alone = 50 mm x 6.7 ps/mm = 335 ps, more than half of the 625 ps bit
    Source-synchronous: flight time cancels; what remains is strobe-to-data mismatch,
                        for example 15 ps of length mismatch + 20 ps of uncertainty in the 90° delay
                        = 35 ps out of 625 ps

    The cost is one strobe per group of data wires, and the group must be routed together and kept short enough that the wires really do see the same delay. That is why memory interfaces group their data lines, each group with its own strobe.

    The design space

    Choice

    What it costs

    When it wins

    Edge-aligned strobe (receiver shifts it)

    A precise delay element at the receiver

    When the transmitter is simple and the receiver is the smarter side (memory reads: the controller shifts)

    Centre-aligned strobe (transmitter shifts it)

    A precise shift at the transmitter

    When the receiver is simple (memory writes: the memory device just samples)

    Single data rate

    Strobe toggles as fast as the data

    Lower rates; simpler capture

    Double data rate

    Capture on both edges; duty cycle matters

    High rates: two bits per strobe cycle

    One strobe per data group

    A wire per group; routing rules

    Wide buses where one strobe cannot match all wires

    How real protocols chose

    Protocol

    Its choice

    DDR memory

    Source-synchronous double data rate. Each data group (typically a byte) has its own strobe, DQS. DQS is edge-aligned with the data on reads, and the controller delays it by about a quarter clock period to sample mid-eye; on writes the controller sends DQS centre-aligned.

    SPI

    The master drives the clock alongside its outgoing data, which makes the master-to-slave direction source-synchronous. Data from the slave does not get its own strobe: it pays the clock's round trip, which limits SPI's speed.

    DDR's split, edge-aligned one way and centre-aligned the other, puts the precise delay circuit in the controller for both directions. The memory devices, made in huge numbers, stay simple.

    What breaks

    A board revision reroutes one byte lane's strobe around a connector, making it 8 mm longer than its data wires (illustrative). At 6.7 ps/mm that is about 54 ps of extra strobe delay. The receiver's quarter-period shift was calibrated for matched routing, so that lane's capture edge now sits 54 ps late, eating into the data's valid window. The lane works on most boards and fails on slow corners and at temperature.

    • Symptom: errors in one byte lane only, temperature-dependent.

    • Evidence: an eye diagram for that lane shows the capture point off-centre.

    • Fix: match the routing, or let the controller train a per-lane delay at start-up (lesson 11.4). Real memory controllers do the latter, because routing is never perfect.

    Why this matters

    Senior lens. Source-synchronous design turns an absolute timing problem (how long is the trip?) into a relative one (how different are two trips?). That is why it scales so much further than a common clock, and also why its failures are about matching: routing length, loading, and the accuracy of the delay that centres the strobe. When you review such an interface, look for what keeps strobe and data matched across process, voltage and temperature, and whether the design trains or tracks that match at run time rather than assuming it.

    Interview

    Asked: "Why is DQS edge-aligned with the data on reads but centre-aligned on writes?"

    Weak answer: That's what the standard says.

    Strong answer: To keep the memory device simple and put the precise timing circuit in the controller for both directions. On reads, the memory just launches data and strobe together, edge-aligned, and the controller shifts DQS by about a quarter period to sample mid-eye. On writes, the controller places DQS in the middle of the data, so the memory can sample directly on the strobe edges.

    Follow-ups: (1) What remains in the timing budget of a source-synchronous link? (2) Why does each byte lane get its own strobe?

    Check yourself In the waveform, why does the receiver not capture on the edges of dqs itself?

    Because the data changes at exactly those edges (edge-aligned). Capturing there would sample data in transition. The quarter-period shift moves each capture edge to the middle of a bit.

    Check yourself A double-data-rate link carries 2 Gb/s per pin. What is the strobe frequency?

    Two bits per strobe cycle, one per edge, so the strobe runs at 1 GHz.

    Check yourself What happens to a source-synchronous budget if the whole board gets 20% slower (all wires equally)?

    Very little: data and strobe slow down together, so their relative timing is unchanged. Only mismatch between them matters. A common-clock link would lose 20% of its flight-time budget.

    Key takeaways

    • Source-synchronous links send a clock or strobe with the data, so the wire delay drops out of the budget and only the mismatch remains.

    • Edge-aligned strobes must be shifted a quarter period at the receiver; centre-aligned strobes can be used directly.

    • Double data rate puts a bit on each strobe edge; DDR memory gives each data group its own strobe.

    Keep going

    Next: Lesson 1.4, Embedded Clocks and Clock Recovery. Go further: send no clock at all, and recover it from the data's own transitions.

    Related topics

    • Part 1 overview: Timing and Clocking

    • RTL course: Source-Synchronous Interfaces

    Previous

    17 / 234

    Next: Embedded Clocks and Clock Recovery

    Up next

    Up nextEmbedded Clocks and Clock Recovery

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Common-Clock Interfaces
    • Skew and Deskew
    • Clock Relationships
    sclkdqsdq01122334455660dqs_90
    Simulation output: data changes on every edge of dqs; the delayed strobe dqs_90 has its edges in the middle of each data bit. One slot is 5 ns; a data bit lasts four slots.