RTL Design #39 · 2026-11-01 · Run detection · Easy · about 10 min
A run detector that pulses on every bit after the third
run_det pulses hit once for every three 1s in a row on a bit stream.
- A bit is transferred in each cycle where
enis 1.dinmeans nothing whileenis 0, and cycles withen= 0 do not interrupt a run. - A transferred 0 ends the run. Runs are counted in groups of three, not overlapping: after a group of three, the next 1 starts a new count. Seven 1s in a row give two pulses, after the 3rd and the 6th.
hitis registered: it is 1 for one cycle, the cycle after the transfer that completed the group.rst_nis a synchronous, active-low reset that forgets any run in progress.
When you press Run, hit fires too often. Fix run_det.sv. Grading uses four hidden checks.
Write and run your answer in the browser. The hidden tests check it, and it’s free.