RTL Design #9 · 2026-10-02 · Counters · Easy · about 10 min
A debouncer that adds up the bounces
debounce cleans up a bouncy switch. noisy is already synchronized to clk and is sampled at every rising edge.
cleanswitches only whennoisyhas been sampled at the levelcleandoesn't have on 4 rising edges in a row. It switches at that 4th edge.- A sample at
clean's own level breaks the run: the next one starts again from 1. - Reset sets
cleanto 0 and starts the count again.
A slow, clean press works. A bouncy one gets through too early. Fix debounce.sv.
Write and run your answer in the browser. The hidden tests check it, and it’s free.