Hardware interview practice
Clock-Domain Crossing Strategies for ASIC Interviews
Given a single-bit level, a narrow pulse, a slowly changing multi-bit setting, and a sustained data stream, choose an appropriate clock-domain crossing (CDC) architecture and implement representative single-bit level and pulse synchronizers.
Example
src_clk: a one-cycle event pulse occurs at t=20 ns
dst_clk: unrelated 7 ns periodThe destination observes exactly one event after synchronization; no combinational multi-bit sample is used.Explanation: A pulse toggle or request/acknowledge synchronizer preserves a brief event across unrelated clocks; a two-flop synchronizer alone is only sufficient for a persistent single-bit level.
Reasoning requirements
- Use a two-flop destination synchronizer only for a stable single-bit level.
- Transfer a pulse with an acknowledged toggle; the source may issue a pulse only while src_ready is high.
- Use a bundled-data handshake for a held multi-bit value and an asynchronous FIFO for a stream.
- Use one shared asynchronous reset event, synchronize its release separately in each domain, and initialize both toggle endpoints to zero.
Concise answer
The answer and the key reason
Deeper explanation
Work through the implementation and tradeoffs
The architecture depends on what must survive the crossing. A single stable bit needs metastability containment, but a pulse may disappear between destination edges. Encoding the pulse as a persistent state change makes it observable; returning an acknowledgment supplies explicit backpressure and prevents a second event from overwriting the first.
Synchronizing every bit of a bus independently cannot guarantee a coherent word, because the bits can settle on different destination cycles. A handshake can transfer an infrequently changed bus while the source holds it, whereas an asynchronous FIFO provides storage and rate decoupling for a stream. Resetting toggle endpoints consistently avoids manufacturing a false event.
What to remember
- Match CDC architecture to traffic
- Handshake narrow pulses
- Never bit-sync arbitrary buses
Practice the complete prompt
