Home › Practice › RTL Design › Pulse synchronizer (toggle)
Pulse synchronizer (toggle)
MediumRTLCDCtwo clocks
A one-cycle pulse on pulse_in in the clk_a domain must become exactly one pulse on pulse_out in the clk_b domain. The two clocks are unrelated, so clk_b may be slower than the pulse. Use the toggle method.
- Ports are fixed:
clk_a,clk_b,rst_a(synchronous toclk_a),rst_b(synchronous toclk_b),pulse_in,pulse_out. Resets are active-high. pulse_inis high for oneclk_aedge per pulse, straight from aclk_aflop. Spacing rule: two pulses are always at least 6clk_bedges apart, so the design does not need to handle faster ones.- Structure: the signal that crosses must go straight into a
clk_bflop and through at least twoclk_bflops before any logic. - Count:
pulse_outis sampled at eachclk_bedge. The number of sampled 1s must never be more than the number of input pulses (no extra or doubled pulse), and 6clk_bedges after a pulse, every pulse must have come out. Only safety is checked (a clock may stop), for 24 steps.
What this grader can and cannot see. Simulators and Studio treat flops as ideal and cannot show metastability, so this grader checks the structure and the worst-case bit timing instead. A structure failure is shown as a message naming the net. A count failure is shown as a table of steps.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.