Part of Curriculum: CDC, RDC and Low-Power RTL (Module 3: Multi-Bit Bus Handshake Synchronization)
View Full Roadmap →
Level 7 Expert ★ Advanced #57 50 pts ✓ Solved

Multi-Bit Bus Handshake Clock-Domain Crossing (CDC)

Advanced RTL & Protocol Design · advanced-rtl, cdc-and-rdc, systemverilog, asic, fpga

Design a 4-phase REQ/ACK handshake synchronizer ensuring coherent multi-bit data bus transfer between asynchronous clock domains.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
SRC REGDOMAIN ASYNC 1METASTABLESYNC 2RESOLVEDDOMAIN A (clk_src)DOMAIN B (clk_dst)src_validsrc_ready
⚡ Timing & Synthesizability Constraints

Timing Contract: Completely asynchronous src_clk and dst_clk. Data bus src_data must remain static throughout the transfer until src_ack is observed.

RTL Constraints: Do NOT pass multi-bit data through flip-flop synchronizers directly. Synthesizable Verilog-2001.

Objective: Implement a multi-bit handshake CDC synchronizer. Explain why synchronizing individual data bits independently across clock domains causes data incoherence (bus skew). Design a source controller and destination controller where multi-bit data is held stable while a 1-bit request line is synchronized through 2 flip-flops, followed by an acknowledge return.

Prerequisites: Clock domain crossing principles, multi-bit bus coherence, 4-phase handshake protocol, metastability.
PortDirWidthDescription
src_clk, src_rst_ninput1Source clock domain and reset
src_valid, src_data[15:0]input1, 16Source payload transfer request
src_readyoutput1Source ready indicating previous transfer complete
dst_clk, dst_rst_ninput1Destination clock domain and reset
dst_valid, dst_data[15:0]output1, 16Captured destination data and 1-cycle strobe
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
Never pass multi-bit data directly through flip-flop synchronizers; physical wire delays cause bits to arrive in different destination clock cycles.
Hint 2: Implementation Architecture & Approach
Hold src_data static in a register while a single 1-bit src_req signal crosses into the destination domain via a 2-flop synchronizer.
Hint 3: Edge Cases, Timing & Verilog Syntax
Once destination samples the synchronized request, it captures the stable data and returns an acknowledge (dst_ack) through another 2-flop synchronizer back to the source.
🔒 Reveal Verified Reference RTL Solution (Click to expand)
⚠️ Self-Discovery Warning: Try solving and simulating first! Viewing the verified reference implementation will bypass the real debugging experience.
Verified Synthesizable RTL
module top_module (
  input  wire        src_clk,
  input  wire        src_rst_n,
  input  wire        src_valid,
  input  wire [15:0] src_data,
  output reg         src_ready,
  input  wire        dst_clk,
  input  wire        dst_rst_n,
  output reg         dst_valid,
  output reg  [15:0] dst_data
);

  // Source domain state
  reg [15:0] data_hold;
  reg        src_req;

  // Synchronize src_req to dst_clk
  reg req_s1, req_s2;

  // Destination domain state
  reg dst_ack;
  reg req_s2_d;

  // Synchronize dst_ack to src_clk
  reg ack_s1, ack_s2;

  // Source domain logic
  always @(posedge src_clk or negedge src_rst_n) begin
    if (!src_rst_n) begin
      src_ready <= 1'b1;
      src_req   <= 1'b0;
      data_hold <= 16'h0;
      ack_s1    <= 1'b0;
      ack_s2    <= 1'b0;
    end else begin
      ack_s1 <= dst_ack;
      ack_s2 <= ack_s1;

      if (src_ready && src_valid) begin
        src_ready <= 1'b0;
        src_req   <= 1'b1;
        data_hold <= src_data;
      end else if (src_req && ack_s2) begin
        src_req <= 1'b0;
      end else if (!src_req && !ack_s2 && !src_ready) begin
        src_ready <= 1'b1; // Completed 4-phase handshake
      end
    end
  end

  // Destination domain logic
  always @(posedge dst_clk or negedge dst_rst_n) begin
    if (!dst_rst_n) begin
      req_s1    <= 1'b0;
      req_s2    <= 1'b0;
      req_s2_d  <= 1'b0;
      dst_ack   <= 1'b0;
      dst_valid <= 1'b0;
      dst_data  <= 16'h0;
    end else begin
      req_s1    <= src_req;
      req_s2    <= req_s1;
      req_s2_d  <= req_s2;
      dst_valid <= 1'b0;

      if (req_s2 && !req_s2_d) begin
        // Rising edge of request in destination domain
        dst_data  <= data_hold;
        dst_valid <= 1'b1;
        dst_ack   <= 1'b1;
      end else if (!req_s2 && dst_ack) begin
        dst_ack <= 1'b0;
      end
    end
  end

endmodule
Verilog-2001 / SV Saved
Font: |
// Click Run Tests (or press Ctrl+Enter) to compile your RTL and simulate against hidden testbenches.
Simulation Timing Diagram (VCD Waveform)
100%
No simulation waveform yet. Run tests to simulate and generate VCD traces.
No compilation run yet. Syntax warnings and elaboration messages will appear here.
No simulation output yet. Raw stdout from vvp will appear here.

RTL Problems / Level 7 · Advanced RTL & Protocol Design

What You Will Learn

By solving Multi-Bit Bus Handshake Clock-Domain Crossing (CDC), you will acquire core industry skills:

  • Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
  • Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
  • Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
  • Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.

Problem Statement & Requirements

Design a 4-phase REQ/ACK handshake synchronizer ensuring coherent multi-bit data bus transfer between asynchronous clock domains.

Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.

Objective: Implement a multi-bit handshake CDC synchronizer. Explain why synchronizing individual data bits independently across clock domains causes data incoherence (bus skew). Design a source controller and destination controller where multi-bit data is held stable while a 1-bit request line is synchronized through 2 flip-flops, followed by an acknowledge return.

Prerequisites: Clock domain crossing principles, multi-bit bus coherence, 4-phase handshake protocol, metastability.

Port List & Interface Timing

The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:

PortDirWidthDescription
src_clk, src_rst_ninput1Source clock domain and reset
src_valid, src_data[15:0]input1, 16Source payload transfer request
src_readyoutput1Source ready indicating previous transfer complete
dst_clk, dst_rst_ninput1Destination clock domain and reset
dst_valid, dst_data[15:0]output1, 16Captured destination data and 1-cycle strobe

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Completely asynchronous src_clk and dst_clk. Data bus src_data must remain static throughout the transfer until src_ack is observed.

Synthesis Constraints: Do NOT pass multi-bit data through flip-flop synchronizers directly. Synthesizable Verilog-2001.

Architectural Deep Dive & Implementation Walkthrough

Why Multi-Bit Buses Cannot Use Simple Synchronizers

If you connect a 16-bit data bus directly to 16 parallel 2-flop synchronizers across unrelated clock domains, differences in silicon routing delays (skew) and metastability resolution will cause some bits to arrive in clock cycle $N$ and others in cycle $N+1$. The destination would sample corrupted intermediate values.

The 4-Phase Handshake Protocol

  1. Phase 1: Source latches src_data into a holding register and asserts src_req = 1.
  2. Phase 2: src_req crosses into dst_clk through a standard 2-flop synchronizer. Since data has been stable for multiple cycles, destination safely latches dst_data and asserts dst_ack = 1.
  3. Phase 3: dst_ack synchronizes back into src_clk. Source deasserts src_req = 0.
  4. Phase 4: Destination deasserts dst_ack = 0. Once source sees ack drop, it asserts src_ready = 1, ready for the next transfer.

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

Allowing src_data to change before the full 4-phase handshake completes.

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

Although latency is 6-8 clock cycles, multi-bit handshakes consume minimal logic compared to an asynchronous FIFO when transmitting low-bandwidth configuration words.

Starter RTL Code

module top_module (
  input  wire        src_clk,
  input  wire        src_rst_n,
  input  wire        src_valid,
  input  wire [15:0] src_data,
  output reg         src_ready,
  input  wire        dst_clk,
  input  wire        dst_rst_n,
  output reg         dst_valid,
  output reg  [15:0] dst_data
);

  // Implement 4-phase multi-bit handshake CDC:
  // 1. Source registers src_data into holding register and asserts src_req = 1.
  // 2. Cross src_req into dst_clk domain via 2-flop synchronizer -> dst_req_sync.
  // 3. When dst_req_sync = 1, capture holding register into dst_data, pulse dst_valid, assert dst_ack = 1.
  // 4. Cross dst_ack into src_clk domain via 2-flop synchronizer -> src_ack_sync.
  // 5. When src_ack_sync = 1, lower src_req = 0.

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module (
  input  wire        src_clk,
  input  wire        src_rst_n,
  input  wire        src_valid,
  input  wire [15:0] src_data,
  output reg         src_ready,
  input  wire        dst_clk,
  input  wire        dst_rst_n,
  output reg         dst_valid,
  output reg  [15:0] dst_data
);

  // Source domain state
  reg [15:0] data_hold;
  reg        src_req;

  // Synchronize src_req to dst_clk
  reg req_s1, req_s2;

  // Destination domain state
  reg dst_ack;
  reg req_s2_d;

  // Synchronize dst_ack to src_clk
  reg ack_s1, ack_s2;

  // Source domain logic
  always @(posedge src_clk or negedge src_rst_n) begin
    if (!src_rst_n) begin
      src_ready <= 1'b1;
      src_req   <= 1'b0;
      data_hold <= 16'h0;
      ack_s1    <= 1'b0;
      ack_s2    <= 1'b0;
    end else begin
      ack_s1 <= dst_ack;
      ack_s2 <= ack_s1;

      if (src_ready && src_valid) begin
        src_ready <= 1'b0;
        src_req   <= 1'b1;
        data_hold <= src_data;
      end else if (src_req && ack_s2) begin
        src_req <= 1'b0;
      end else if (!src_req && !ack_s2 && !src_ready) begin
        src_ready <= 1'b1; // Completed 4-phase handshake
      end
    end
  end

  // Destination domain logic
  always @(posedge dst_clk or negedge dst_rst_n) begin
    if (!dst_rst_n) begin
      req_s1    <= 1'b0;
      req_s2    <= 1'b0;
      req_s2_d  <= 1'b0;
      dst_ack   <= 1'b0;
      dst_valid <= 1'b0;
      dst_data  <= 16'h0;
    end else begin
      req_s1    <= src_req;
      req_s2    <= req_s1;
      req_s2_d  <= req_s2;
      dst_valid <= 1'b0;

      if (req_s2 && !req_s2_d) begin
        // Rising edge of request in destination domain
        dst_data  <= data_hold;
        dst_valid <= 1'b1;
        dst_ack   <= 1'b1;
      end else if (!req_s2 && dst_ack) begin
        dst_ack <= 1'b0;
      end
    end
  end

endmodule

Related RTL Problems in Level 7

  • Async-Assert / Sync-Deassert Reset — Assert reset the instant it goes active, but only release it once it has been clean for 2 clock edges — the standard reset architecture for any real design.
  • 3-Flop CDC Synchronizer — A deeper 3-stage synchronizer for signals that need extra MTBF margin beyond the standard 2-flop chain.
  • Synchronized Rising-Edge Detector — Safely synchronize an asynchronous level signal, then produce a clean single-cycle pulse the moment it rises in the local clock domain.

Frequently Asked Questions

What does Multi-Bit Bus Handshake Clock-Domain Crossing (CDC) require?

Design a 4-phase REQ/ACK handshake synchronizer ensuring coherent multi-bit data bus transfer between asynchronous clock domains. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: advanced-rtl, cdc-and-rdc, systemverilog, asic, fpga. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.

How is my solution graded?

A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.

How does this challenge help with semiconductor interviews?

Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of Multi-Bit Bus Handshake Clock-Domain Crossing (CDC) to assess real-world synthesizability and race-condition awareness.