RTL Design #49 · 2026-11-11 · Handshake CDC · Medium · about 20 min

A handshake that starts again too early

hs_xfer sends a byte from clock domain A to clock domain B with a four-phase handshake. A holds the byte and raises req; B sees it through a 2-flop synchronizer, takes the byte and sends back ack (the synchronized req); A sees ack through its own synchronizer and drops req; B drops ack once it sees req low.

  • send with busy low starts a transfer: din is captured and exactly one dvalid pulse (with dout) comes out on B. send while busy is ignored.
  • A transfer must complete before the next one starts, whatever the ratio of the two clocks.

Run sends four bytes back-to-back as soon as busy is low, with B slower than A. Some of them never arrive. Fix hs_xfer.sv.

Write and run your answer in the browser. The hidden tests check it, and it’s free.