Three Flop Synchronizer for High Frequency
Clock domain crossing into high frequency domains requires careful Mean Time Between Failures (MTBF) management. A standard two stage synchronizer is insufficient if the clock period is shorter than the resolution time required to settle metastability. In these extreme frequency environments, additional synchronization stages are required to maintain system reliability.
The module receives an asynchronous single bit signal and synchronizes it to the destination clock domain. To support reuse across different clock domains, the number of synchronization stages must dynamically adjust based on the provided TARGET_FREQ_MHZ parameter. If the target frequency is 400 MHz or less, the design requires 2 stages. If the frequency is strictly greater than 400 MHz and less than or equal to 800 MHz, it requires 3 stages. If the frequency is strictly greater than 800 MHz, it requires 4 stages.
- Clock edge:
posedge clk - Reset type: Asynchronous active low (
rst_n) - Output values on reset: All synchronizer stages, including
sync_out, must go to 0 whenrst_nis 0 - Priority rules: Asynchronous reset has priority over all other inputs and immediately clears the synchronization chain
Cycle by cycle trace for the default 3 stage configuration (TARGET_FREQ_MHZ = 500): Cycle 1: rst_n=0, async_in=0 → internal=[0,0,0], sync_out=0 Cycle 2: rst_n=1, async_in=1 → internal=[1,0,0], sync_out=0 Cycle 3: rst_n=1, async_in=1 → internal=[1,1,0], sync_out=0 Cycle 4: rst_n=1, async_in=1 → internal=[1,1,1], sync_out=1 Cycle 5: rst_n=1, async_in=0 → internal=[0,1,1], sync_out=1 Cycle 6: rst_n=1, async_in=0 → internal=[0,0,1], sync_out=1 Cycle 7: rst_n=1, async_in=0 → internal=[0,0,0], sync_out=0
{ "signal": [
{ "name": "clk", "wave": "p......" },
{ "name": "rst_n", "wave": "01....." },
{ "name": "async_in", "wave": "01..0.." },
{ "name": "sync_out", "wave": "0...1.0" }
], "head": { "text": "Three stage synchronization of an asynchronous pulse." } }| Parameter | Default | Description | |-----------|---------|-------------| | TARGET_FREQ_MHZ | 500 | Target clock frequency in MHz used to calculate stages |
| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | clk | input | 1 | Destination clock, positive edge triggered | | rst_n | input | 1 | Asynchronous active low reset | | async_in | input | 1 | Asynchronous input signal | | sync_out | output | 1 | Synchronized output signal |
Constraints
- Output
sync_outmust be driven by the final flip-flop in the synchronization chain; do not use combinational logic for the output - All flip-flops must be reset asynchronously to 0 when
rst_nis 0 - The number of stages must be exactly 2 for
TARGET_FREQ_MHZ <= 400, 3 for400 < TARGET_FREQ_MHZ <= 800, and 4 forTARGET_FREQ_MHZ > 800
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against a real testbench — you get the waveform back, not a stored answer.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.