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.
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:
| Port | Dir | Width | Description |
|---|---|---|---|
src_clk, src_rst_n | input | 1 | Source clock domain and reset |
src_valid, src_data[15:0] | input | 1, 16 | Source payload transfer request |
src_ready | output | 1 | Source ready indicating previous transfer complete |
dst_clk, dst_rst_n | input | 1 | Destination clock domain and reset |
dst_valid, dst_data[15:0] | output | 1, 16 | Captured destination data and 1-cycle strobe |
Timing Constraints & Synthesizable RTL Rules
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
- Phase 1: Source latches
src_datainto a holding register and assertssrc_req = 1. - Phase 2:
src_reqcrosses intodst_clkthrough a standard 2-flop synchronizer. Since data has been stable for multiple cycles, destination safely latchesdst_dataand assertsdst_ack = 1. - Phase 3:
dst_acksynchronizes back intosrc_clk. Source deassertssrc_req = 0. - Phase 4: Destination deasserts
dst_ack = 0. Once source sees ack drop, it assertssrc_ready = 1, ready for the next transfer.
Common RTL Designer Pitfalls
Allowing src_data to change before the full 4-phase handshake completes.
Silicon & Hardware Engineering Notes
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.
Connected EcrioniX Learning Resources
Accelerate your VLSI engineering knowledge with these curated learning materials:
Progress through step-by-step verified modules from fundamentals to advanced silicon design.
Benchmark your hardware knowledge across 10 semiconductor domains and receive study roadmaps.
Explore foundational circuit theory, waveform timing, and physical hardware implementation.
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.