Asynchronous Assertion and Synchronous Deassertion
A reset can be asserted at any moment, but it has to be released in step with the clock. Released at the wrong instant, some flip-flops leave reset a cycle before others. The standard fix asserts reset asynchronously and releases it through a two-flop synchronizer.
The module accepts an external asynchronous active-low reset and synchronizes it to a local clock domain. When the external reset is asserted low, the synchronized output must immediately drop low without waiting for a clock edge. When the external reset is deasserted high, the synchronized output remains low until it safely propagates through a two-stage synchronization chain. The output only returns high after two consecutive rising clock edges following the deassertion of the external reset.
Timing and Reset Rules:
- Clock edge: Positive-edge triggered
clk - Reset type: Asynchronous, active-low
rst_async_n - Output behavior on reset: The output
rst_sync_ngoes to 0 immediately whenrst_async_nis 0, regardless of the clock state. - Normal operation: Once
rst_async_nis released to 1, a logic 1 must propagate through two sequential flip-flops. - Registered output: The output
rst_sync_nis driven directly by the second flip-flop in the synchronization chain.
Worked Trace:
Cycle 1: rst_async_n=0, clk=0 → rst_sync_n=0 (Asynchronous assertion immediately clears output)
Cycle 2: rst_async_n=1, clk=0 → rst_sync_n=0 (Reset deasserted, but output held low waiting for clock)
Cycle 3: rst_async_n=1, clk=1 → rst_sync_n=0 (First positive clock edge captures high state in first stage)
Cycle 4: rst_async_n=1, clk=0 → rst_sync_n=0 (Output remains low)
Cycle 5: rst_async_n=1, clk=1 → rst_sync_n=1 (Second positive clock edge captures high state in second stage; synchronous deassertion complete)
| Signal | Direction | Width | Description |
|---|---|---|---|
clk |
input | 1 | Destination clock domain, positive-edge triggered |
rst_async_n |
input | 1 | Asynchronous active-low reset from source domain |
rst_sync_n |
output | 1 | Synchronized active-low reset for destination domain |
Constraints
- The output
rst_sync_nmust assert asynchronously whenrst_async_nis 0. - The output
rst_sync_nmust deassert synchronously on the positive edge ofclk. - The synchronization chain must be exactly two stages deep.
- Do not use latches.
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.
Free to solve. A Codiode account keeps your progress.
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.
Part of Clock Domain Crossing and Synchronization
Problem 2 of 36 in the Clock Domain Crossing and Synchronization track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks