RTL Foundations / F14

Reset and Clock Domains: Why Can Another Clock Miss the Event?

Replay a short pulse at two clock phases, then trace a held request, data delivery and reset release in each domain.

Lesson film

Film chapters

TranscriptCaptionsDownload film

The first F13 result is hexadecimal 034. The manager needs only the byte 34 and has its own clock. The collector drives a pulse high for one source cycle, then drives it low. Will the manager always see it? Draw the two clocks first. At a clock-domain boundary, delivery cannot rely on a shared rising edge.

A running clock can still miss the entire pulse

The source period is 10 ns, with rising edges at 5, 15, 25 ns and so on. The source raises the pulse at 15 ns and drops it at 25 ns. The destination period is 16 ns. Keep both periods fixed and vary the time of the first destination rising edge. It serves as the phase label: phase 4 or phase 12.

Destination clockFirst three rising edgesSampler output after edgePulse observed?
Phase 44, 20, 36 nsreset clears output, 1, 0Yes, at 20 ns
Phase 1212, 28, 44 nsreset clears output, 0, 0No

For phase 4, the edge at 20 ns lies inside the high interval. For phase 12, 12 ns is too early and 28 ns is too late. Simulation releases reset at 13 ns. At the first edge of each phase, reset clears the receiving register. At 4 ns the source has yet to reach its first rising edge, so the raw pulse is X and reset still makes the receiver output zero. By 12 ns the source was reset at 5 ns. The pulse is zero and the receiver is still in reset.

The source pulse rises at 15 ns and falls at 25 ns. Phase 4 of the 16 ns clock reads one at 20 ns. Phase 12 sees no high level at 12, 28 or 44 ns.
The ideal waveform comes from Icarus VCD. The 4 ns destination output is zero because of reset. After release, phase 12 misses because its sample edges fall outside the high interval.

Seeing the pulse once answers one sampling question

The sample edges above avoid transitions in the pulse. In real hardware a flip-flop requires its input to stay stable for a short time before and after an edge. If a crossing signal changes in that interval, the first receiving flip-flop may become metastable. Its output may take extra time to resolve to a stable zero or one.

A common starting point for single-bit control is a two-stage synchronizer on the destination clock. The first stage samples the crossing. The second samples its Q one destination cycle later, allowing time for the first output to resolve. Downstream logic uses the final stage. Avoid feeding multiple logic paths from the first stage. Clock rate, signal activity, device characteristics and synchronizer routing all affect reliability. Choose the synchronizer for the requirements and implementation conditions.

The synchronizer reduces the chance that an unresolved value propagates. If a short pulse falls entirely between destination edges, the first stage still misses it. Reading one at a particular phase in the test establishes that the high interval contains that ideal sample point.

Hold the event until the other side receives it

The manager needs the byte 34. The source stores that byte and raises request. Since request stays high, phase 12 can see it at 28 ns. The runnable extension keeps the destination at phase 12 and uses two stages to receive the request. The first updates at 28 ns and the second at 44 ns. At 60 ns the manager sees the settled second-stage value, captures 34 and raises ack.

The source raises request at 15 ns. The destination synchronizes it at 28 and 44 ns, captures byte 34 and raises ack at 60 ns. The source clears request at 85 ns.
The phase 12 destination synchronizes request at 28 and 44 ns and captures the word at 60 ns. The source holds request and data until ack returns.

Ack crosses back through two source stages, which update at 65 ns and 75 ns. The source sees the synchronized ack at 85 ns and clears request. Once the manager sees the synchronized request go low, it clears ack. The source waits until that low level crosses back before accepting another word. This four-phase handshake allows one outstanding word.

If the source changes data while waiting for ack, the manager may receive a word that belongs to a different request. Here the source holds the complete word. The bundled data path also needs timing constraints so the entire word settles with margin before destination capture. Giving every bit its own two-stage synchronizer can make bits from one source update appear in different destination cycles. The resulting word can mix values from two updates.

Separate asserting and releasing active-low reset

To assert reset is to drive it active. To deassert it is to release it. For active-low rst_ni, assert by driving low and release by driving high. The verb assert here refers to a reset action. In F15, an assertion checks a property.

A synchronous reset only changes its registers on an active edge. An asynchronous reset can assert between edges. A common design for asynchronous assertion with synchronous release gives each clock domain its own reset release chain. Pulling the global reset low clears both stages. Returning it high lets the first register take a one and the second register take that one on the next local edge.

Global active-low reset asserts at 1 ns and deasserts at 19 ns. The source releases locally at 35 ns and the destination at 44 ns, each on its own second rising edge.
This Icarus reset model runs separately from the handshake. Global reset releases at 19 ns. The source releases at 35 ns and the phase 12 destination at 44 ns.

Asynchronous reset release needs physical recovery and removal checks. One domain may resume before its peer can send or receive. The lab tests the handshake under a controlled common reset policy. If the product permits unilateral reset, define what happens to outstanding requests, data and acknowledgements, and verify the reset-domain crossings.

Does the crossing carry a state, an event or a word?

A sustained single-bit level can use a destination synchronizer. An event can use a held request and acknowledgement. A word can use a constrained handshake or asynchronous FIFO.
Specify what the receiver needs before choosing the circuit. Receiving a level, one event and one coherent word are different contracts.
SignalReceive contractConditions to check
Sustained single-bit levelRead the settled state after synchronization latencyLevel duration, synchronizer structure and reliability
Short pulseDeliver each emitted event onceHold request until ack, avoid accepting an event without space, check reset and event rate
Multi-bit wordRead all bits of the same wordConstrain a held-data handshake or use a suitable asynchronous FIFO
Encoded pointerInterpret only the states specified by the encodingEven a Gray pointer with one bit changing per source increment needs timing and inter-bit skew constraints

Replay the experiment in an extracted copy

Download the lab package, extract it on Linux or WSL and run bash run.sh. Check the two sampled phases against the independently calculated Python table. Icarus 12.0 also exercises one delivery of 34 and the local reset release. Yosys 0.33 checks the generic two-stage control and reset structures. See the run summary, raw waveform and evidence with hashes.

A hardware implementation still needs CDC and reset-domain review, crossing constraints and evidence about the implemented synchronizer. Estimating mean time between failures (MTBF) also requires device and operating-condition data.

Transfer question: shorten the notification from four source cycles to one

The source period is 10 ns and the destination period is 16 ns. Both clocks keep running. A notification used to last four source cycles and now lasts one. Which ideal sampling assumption stops holding? Which phase reproduces the problem?

Answer

The original level is high for 40 ns, longer than the 16 ns destination period. Every ideal phase then has at least one sample in the high interval. A 10 ns level loses that guarantee. Phase 12 misses it between 12 ns and 28 ns. If every event must arrive, specify a delivery protocol such as holding request until ack. Physical setup, hold and synchronization delay still matter.

The next lesson writes the rule that a stalled result must hold as a property and checks that the test actually reaches a stall.

Will the next clock see the event?

The source raises a request at 15 ns. A short pulse ends at 25 ns. A held request remains high until acknowledged. Move the first rising edge of the 16 ns destination clock and look for the first high sample.

Download RTL, testbench and results

Check your understanding

1. The pulse goes high at 15 ns and drops at 25 ns. Destination rising edges are at 12, 28 and 44 ns. Which samples a one?
2. The phase-4 Icarus waveform sees the pulse at 20 ns. What has this run established?
3. Request is held from 15 ns. The destination stages update at 28 and 44 ns. The manager reads stage two in a clocked block and captures the word. On which edge?
4. Global active-low reset goes high at 19 ns. The two-stage release chains see source edges at 25/35 ns and destination edges at 28/44 ns. When do they release?
5. A notification shrinks from 40 ns to 10 ns. The destination clock still runs with a 16 ns period. How can the link deliver every accepted event?