You do not have active access to the CDC Masterclass. Please visit the dashboard to purchase or renew your access.
Return to Course DashboardTechniques for safely synchronizing related control signals across clock domains.
As covered in previous modules, independently synchronizing two related signals that cross a clock domain boundary is a cardinal sin in VLSI design. Consider a scenario where a transmit logic block sends a load pulse and a direction bit to a receive block in a different clock domain.
Because flip-flops have inherent set-up and hold times, and because synchronizers can take varying amounts of time to resolve metastability, the two signals may not arrive at the destination domain simultaneously. The destination might sample load=1 but capture the old direction value, leading to data corruption or silent functional failure.
The most robust way to synchronize multi-bit control information is to transform the multi-bit relationship into a single bit before the crossing occurs. This is known as logic consolidation.
If you have an operation requiring two control signals, you can encode these requests into distinct, disjoint states (such as a 1-hot encoding) where only one bit transitions at a time, or merge the logic altogether to emit a single flag that triggers a known sequence on the destination side.
If multiple control signals $C_1, C_2, \dots, C_n$ must be sampled together by a destination domain $D$, there must exist a function $F(C_1, C_2, \dots, C_n) \rightarrow S$ evaluated in the source domain $S$, such that only a single signal $S$ crosses to $D$.
When the control signals are states of a sequential machine (like an FSM state vector crossing a domain boundary), simple logic consolidation might not be feasible. Instead, we encode the states using Gray code.
By definition, adjacent states in a Gray code differ by only a single bit. If the state machine progresses linearly (or conditionally, provided valid transitions are always separated by a Hamming distance of 1), the multi-bit vector can safely cross the domain boundary because any sampling error will at worst evaluate to either the previous state or the new state, never an intermediate invalid state.
Never let independently synchronized signals recombine (reconverge) in combinational logic in the destination domain. They may arrive out-of-phase. Always consolidate in the source domain before crossing.
Observe the structural differences between dangerous parallel synchronization and safe consolidated synchronization.
Below is a synthesizable Verilog implementation demonstrating how to consolidate a request and a mode bit into a safely synchronizable pulse train.
// Module: signal_consolidator
// Purpose: Safely cross a request and mode bit into a new domain by encoding them.
module signal_consolidator (
input wire clk_a,
input wire rst_a_n,
input wire req_in,
input wire mode_in,
input wire clk_b,
input wire rst_b_n,
output reg mode_a_out,
output reg mode_b_out
);
// --- Domain A (Source) ---
// Instead of passing req_in and mode_in separately, we generate two distinct
// pulses depending on the mode. We enforce that they are mutually exclusive.
reg req_mode_a;
reg req_mode_b;
always @(posedge clk_a or negedge rst_a_n) begin
if (!rst_a_n) begin
req_mode_a <= 1'b0;
req_mode_b <= 1'b0;
end else begin
// Consolidate into independent, single-bit toggles (pulse generation assumed)
req_mode_a <= req_in & (mode_in == 1'b0);
req_mode_b <= req_in & (mode_in == 1'b1);
end
end
// --- Domain B (Destination) ---
// Two parallel synchronizers are safe here because the source guarantees
// req_mode_a and req_mode_b will NEVER toggle simultaneously.
reg [1:0] sync_mode_a;
reg [1:0] sync_mode_b;
always @(posedge clk_b or negedge rst_b_n) begin
if (!rst_b_n) begin
sync_mode_a <= 2'b00;
sync_mode_b <= 2'b00;
end else begin
sync_mode_a <= {sync_mode_a[0], req_mode_a};
sync_mode_b <= {sync_mode_b[0], req_mode_b};
end
end
// Recover logic in Domain B
always @(posedge clk_b or negedge rst_b_n) begin
if (!rst_b_n) begin
mode_a_out <= 1'b0;
mode_b_out <= 1'b0;
end else begin
mode_a_out <= sync_mode_a[1];
mode_b_out <= sync_mode_b[1];
end
end
endmodule
Assume we have a system where a controller asserts req to initiate a read or write operation. The operation type is denoted by mode (0 for read, 1 for write). The signals cross from a 100MHz domain to a 250MHz domain.
req |
mode |
Source Consolidation | Crosses As (Safe) | Destination Decoded |
|---|---|---|---|---|
| 0 | X | Idle | 00 |
No Action |
| 1 | 0 | Trigger read_req |
10 |
Read Event |
| 1 | 1 | Trigger write_req |
01 |
Write Event |
Notice that only a single bit transitions during the transition from Idle to active, ensuring safe sampling at the 250MHz domain.
Logic consolidation is highly effective but possesses rigid constraints:
Multi-bit signals crossing a clock domain must be converted into single-bit toggles or Gray-coded vectors in the source domain. Relying on parallel synchronizers for dependent multi-bit signals guarantees non-deterministic failure.