Demo 6.6: Registers, and Circuits That Walk a Chosen Sequence

The synchronous counter page ended with a description of the circuit that did not mention counting: flip-flops holding a state, combinational logic working out the next one, and a clock stepping between them. A counter is that structure with the simplest possible next-state logic.
So what happens if you take the next-state logic away?
You get a register. Four D flip-flops side by side, one clock wire to all of them, and each D fed from somewhere. There are no gates in it. It performs no computation and does not count, and it is still one of the most widely used circuits in the module.
Where each D input comes from
Section titled “Where each D input comes from”Each flip-flop has a D input, and something has to be connected to it. That is the only design decision available, and every circuit on this page is a different answer to it:
| Where D comes from | What the circuit becomes |
|---|---|
| Its own input pin | A storage register. It remembers a word. |
| Its own Q | A register that holds. This is what a load enable does. |
| The Q of the stage before it | A shift register. The word moves along, one stage per clock. |
| The Q of the last stage | A ring counter. The word circulates indefinitely. |
| The Q̄ of the last stage | A Johnson counter. Twice as many states, one inverter. |
Same four flip-flops in every row. Same single clock. One wire moved.
Keep this in mind, because the four circuits are usually taught separately with four separate diagrams, which hides the fact that they are the same hardware with a different source for D.
Why shift registers are used
Section titled “Why shift registers are used”The purpose of a storage register is clear: you have a value and you want to keep it.
The shift register takes more explaining, and the explanation is about the number of wires rather than about registers.
Sending an eight-bit value from one chip to another needs eight wires, and the cost of wires is easy to underestimate. Eight pins on the package at each end. Eight tracks on the board. Eight conductors in the cable, and a connector wide enough for them. Widen the value to sixteen bits and all of those costs double.
Or send it on one wire, one bit at a time, and take eight clocks over it. The pin count no longer depends on the width.
A shift register is the converter between those two, and it converts in whichever direction you read it. That is the trade the third tab is about, and it is the reason this circuit is in every serial link, every serial port, and every part that drives more outputs than the processor has free pins.
How to use it
Section titled “How to use it”Holding a word is the storage register. Set the four data inputs, then clock. The point of the tab is the difference between the inputs and the outputs: the outputs only take on the input values at an edge, and that is the reason a register exists.
Shifting it along moves one wire and runs the same four flip-flops as a shift register. There is a serial pattern you can edit a bit at a time, and the waveforms underneath show every output as the one above it delayed by one clock.
Serial and parallel puts numbers on the trade. Pick a width and a shift clock and read the two panels against each other, then the four in/out arrangements and what each one is for.
Walking a sequence feeds the output back to the input. The register then steps through a fixed loop of states, and the tab ends with all sixteen states laid out so you can see the loops that were not designed.
Registers, and Circuits That Walk a Chosen Sequence
Four flip-flops, one clock, and one wire moved: a word held, a word walked along, wires traded against time, and a sequence somebody chose.
Walkthrough
Section titled “Walkthrough”Step 1: Compare the inputs and the stored value
Section titled “Step 1: Compare the inputs and the stored value”Open Holding a word. The inputs show 1011 and the register is holding 0000.
Both are correct. The inputs are the value presented; the outputs are the value stored. A register keeps those two separate.
Press Clock once and they match. Now change any input bit and watch the outputs: they do not change. Change another, with the same result.
The source of that data can change it at any time, and the register outputs the last value it loaded until the next edge. Every clocked system is built on that property.
Step 2: See how a load enable works
Section titled “Step 2: See how a load enable works”Set the enable to Disabled and press the clock. Nothing happens, which is what you would expect.
Now look at how nothing happened. The clock still arrived at every flip-flop and every flip-flop was still triggered by it. What changed is where each D came from: with the load disabled, each D is fed from its own Q, so each stage reloads the value it already had.
From outside this looks like doing nothing, but every stage is still clocked and still loads a value.
Step 3: Move one wire
Section titled “Step 3: Move one wire”Open Shifting it along.
Each D has come off its own pin and gone to the Q of the stage before it. Nothing else about the circuit has changed: same flip-flops and the same single clock.
Press Step one clock four times and watch the pattern shift in from the left, one stage per clock. After four clocks a word that arrived one bit at a time is present across the four outputs, side by side.
That is the conversion: a value spread out in time has become a value spread out across the outputs.
Now read those outputs carefully, because there is a trap in them. The serial input sent 1, 0, 1, 1 in that order, and the outputs read 1101 from Q₀ to Q₃. Those are not the same string, and nothing has gone wrong: the first bit sent has had four clocks to travel and is now in the last stage.
Which end you call the first bit is a convention rather than a fact, and it is one that both ends of a serial link have to agree on before anything works at all. Send the least significant bit first and you read the register one way round; send the most significant first and you read it the other.
Keep stepping and the word shifts out of the far end.
Step 4: Ask why the data does not pass through in one clock
Section titled “Step 4: Ask why the data does not pass through in one clock”This is an important question, and most students do not think to ask it.
Every stage is clocked at the same instant. Every stage’s D input is connected to the output of the stage before it. So when the edge arrives, what stops a 1 at the input travelling the whole length of the register in one go?
The answer is that a flip-flop looks at its D input at the edge, not after it. Every stage captures the value its neighbour output just before the edge, not the value it is about to change to. All four pass their contents on simultaneously, and each receives what its neighbour was holding.
That only works because outputs take a little time to change. The data has to remain stable for a short time after the edge, which is the hold time, and here it is met by the flip-flop’s own propagation delay.
A shift register is therefore the circuit that hold time exists for. If you have wondered why that number is on a data sheet, this is the answer.
Step 5: Put numbers on the trade
Section titled “Step 5: Put numbers on the trade”Open Serial and parallel and set the width to 8 bits at 1 MHz.
- Parallel: 8 wires, one clock, 1.00 µs.
- Serial: 2 wires, eight clocks, 8.00 µs.
Now step the width up to 32 bits. The parallel wire count goes to 32. The serial wire count does not change.
That is the advantage of serial transfer. The serial cost in wires is independent of the width, and the penalty is time, which is usually available. Very little in an embedded system needs a value inside a microsecond.
The penalty matters for anything that must be fast and wide at once, which is why the memory bus inside a computer is still parallel and the cable to the printer is not.
Step 6: Choose a sequence
Section titled “Step 6: Choose a sequence”Open Walking a sequence.
The serial input has come off its pin and gone to the last stage’s output. Nothing now enters the register and nothing leaves it. Whatever pattern is inside circulates, one place per clock, for as long as the clock runs.
Start it from One bit set and press play. The pattern is 1000, 0100, 0010, 0001, and back to the beginning.
Look at that sequence and try to find the arithmetic in it. There is none. It is not counting up or down, and the four states are not consecutive binary values. The designer chose that order and wired the feedback to produce it.
This is the first circuit in the module whose behaviour is a design decision rather than a consequence of arithmetic, and that is why it is here.
Then switch to Johnson and see what one inverter adds: eight states from the same four flip-flops instead of four, because the pattern fills with ones from the left and then empties from the left.
Step 7: Find the undesigned states
Section titled “Step 7: Find the undesigned states”Still on the last tab, press Two bits set.
The register now cycles through 1010, 0101, 1010, 0101, indefinitely. Two states, not four, and no clock edge will move it out of this loop.
Be precise about what has gone wrong here: the circuit is not broken. No component has failed, nothing is out of specification, and the feedback is doing what it was built to do. The design did not specify what should happen from this state.
Now look at the panel at the bottom of the tab, which steps through all sixteen states and shows every loop the wiring produces.
| Loop | States | Is it the design? |
|---|---|---|
1000 → 0100 → 0010 → 0001 | 4 | Yes |
1100 → 0110 → 0011 → 1001 | 4 | No |
1110 → 0111 → 1011 → 1101 | 4 | No |
1010 → 0101 | 2 | No |
0000 | 1 | No |
1111 | 1 | No |
Six separate loops, and no way between them. A four-bit ring counter has sixteen states, of which the design uses four and leaves the other twelve unspecified, and a circuit that has powered up into one of them will stay there until the power is removed.
Try All zeros as well. With no bits set there is nothing to circulate, so the counter outputs zeros indefinitely, which is the most likely failure for a real ring counter.
Switch to Johnson and the result is different but has the same problem: sixteen states split into two loops of eight. The parasitic loop is the same length as the intended one, so a Johnson counter in the wrong loop looks correct on a scope. It is producing the wrong phases.
Check your understanding
Section titled “Check your understanding”A four-bit storage register is holding 0110. Its data inputs are changed to 1011 and no clock edge occurs. What do the outputs show?
In a shift register, every stage is clocked at the same instant and every stage's D input is connected to the output of the stage before it. What stops a bit travelling the whole length of the register on one edge?
A four-bit ring counter is switched on and comes up holding 1010. What happens?
Match each item to what it is
Which statements about shift registers and ring counters are true? Select all that apply.
Wrap-up
Section titled “Wrap-up”Five things to take away.
- A register is flip-flops with no logic between them. It computes nothing. The clock edge acts as the instruction “store what is on the inputs, now”.
- Every circuit here is the same hardware with one wire moved. Where D comes from is the only decision, and it turns the same four flip-flops into a store, a shifter, a delay line or a counter.
- A shift register converts between time and wires. Bits arriving one at a time leave as a word, and a word leaves one bit at a time. The serial cost in wires does not depend on the width.
- Hold time is why it works. Each stage captures what its neighbour was showing just before the edge, so the contents advance exactly one place per clock instead of passing through the whole register.
- Feed the output back and the sequence becomes a choice. A ring counter steps through four states because the designer chose them, and the twelve states it leaves undefined are still there.
That last point is the main one of this demonstration.
Every sequential circuit in the module so far has done something arithmetic. A counter’s sequence follows from addition; the AND chain in the synchronous counter is the carry chain from binary arithmetic. The ring counter is the first circuit whose sequence was specified rather than derived, and the moment a sequence can be specified, two new questions follow: what should the next state be from every state, including the ones you did not plan to visit, and what logic produces that?
Those two questions are the whole of finite state machine design, and you already have the tools for both. A state table says what follows what. Karnaugh maps turn a state table into gates. Flip-flops hold the state and a clock steps between them, as they have done since the latch.
A counter is that construction with the simplest possible sequence. A ring counter is that construction with a chosen sequence. What comes next is that construction with a sequence chosen to do a job, and inputs that change which way it goes, which is what a processor is made of.
© 2026 Derek Molloy, Dublin City University. All rights reserved.