Home › Practice › Design Verification › Waveform: the shift register that shifts the wrong way

Waveform: the shift register that shifts the wrong way

EasyWaveformdebugshift register

A 4-bit shift register takes one bit din per clock. The spec says: while rst is 1 the register clears. Otherwise, on every clock edge the new bit enters at the lowest bit and every bit moves one place up, so the oldest bit leaves from the top. The register q is shown in binary, top bit on the left. The waveform from your teammate's test is below.

Concept first. A shift register is a history of the last few inputs. Writing the value in binary lets you see where each bit went. Take a single 1 entering an empty register and follow it: where does it sit one cycle later, and two cycles later? The direction is easy to get backwards, so predict the first cycle after a 1 enters on paper before you look at the output.

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

← Waveform: the pulse that is too longTiming: fewer gates, slower path →