Home › Practice › Design Verification › Waveform: the counter that stops early

Waveform: the counter that stops early

EasyWaveformdebugcounter

A teammate says their 4-bit counter works. The spec says: while rst is 1 the count goes to 0. Otherwise, on every clock edge where en is 1, the count goes up by one, and it wraps to 0 only after 15. When en is 0 it holds its value. The waveform from their test is below, one column per clock cycle.

Concept first. Debugging a design starts with reading a waveform against the spec. Do not hunt for the strange-looking spot. Instead take the spec as a rule, walk the cycles from the left, and at each cycle ask what the output should be. The bug is the first cycle where the rule and the waveform disagree. Everything after it can be wrong too, but that is only a side effect, so the first one is the one to find.

What to do.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Divisible by 3?Waveform: the detector that misses a repeat →