Exercises — Ring and Johnson counters
Ten worked problems, easiest first, each with a full solution you can hide. This page is self-contained: every symbol is defined right here before it is used. For extra background see the parent note. Notation used throughout:
- = number of flip-flops (cells) in the register.
- = the four stored bits, written leftmost-first, where the leftmost written bit is and the rightmost is . A 1 means "that cell is high (lit)", a 0 means "low (dark)".
- Physical layout and shift direction (fixed for this whole page). Picture the four cells drawn left-to-right as . Each flip-flop has a data input written — the value that flip-flop will take on the next clock tick. The wiring is . In words: on every tick each cell copies the cell to its left, and the leftmost cell takes the fed-back bit . Because bits move from a higher index to a lower index, the visible pattern slides toward the (right) end. This is the one shift convention used in every problem below.
- = the complement (logical NOT) of : it flips . Throughout this page NOT is written only with an overbar, e.g. ; we never use any other NOT symbol.
- Boolean-algebra symbols (used from L3 onward): a raised dot (often written just ) means AND — it is 1 only when both and are 1, like two switches in series. A plus means OR — it is 1 when either input is 1, like two switches in parallel. The overbar is NOT (above). These are logic operations on single bits, not ordinary arithmetic: e.g. here, not .
Work each problem on paper first, then open the solution.
Level 1 — Recognition
L1.1 Count the states
An engineer builds a ring counter from 6 flip-flops, and a Johnson counter from 6 flip-flops. How many valid (used) states does each have?
Recall Solution
A ring counter circulates one hot bit through positions, so it has states. A Johnson counter fills then empties, taking steps, so states. With :
L1.2 Spot the wire
Here are two feedback wirings for a 4-bit shift-register counter (the fed-back bit drives , the input of the leftmost cell ):
- Circuit A:
- Circuit B:
Which is the ring counter, and which is the Johnson counter?
Recall Solution
The single difference is the inverter. Feeding back the straight output copies the last bit → Circuit A is the ring counter. Feeding back the complement twists the ring → Circuit B is the Johnson counter.
(Note on convention: the parent note wired feedback from because it drew the register in the opposite orientation. On this page bits slide toward , so the "last" cell the bit reaches is , and feedback is taken from . The two descriptions are the same circuit, just mirrored on paper.)
Level 2 — Application
L2.1 Trace a ring counter
A 4-bit ring counter with the standard wiring of this page (, i.e. feedback ) is preset to . Write the states for clocks 1 through 4.
Recall Solution
Apply the fixed shift rule from the notation box: each cell copies the cell to its left, and takes the fed-back bit . So the whole pattern slides one place toward (the right), and the bit that leaves the end re-enters at the end.
| Clock | |
|---|---|
| init | 1000 |
| 1 | 0100 |
| 2 | 0010 |
| 3 | 0001 |
| 4 | 1000 (repeat) |
After 4 clocks the 1 has visited all 4 cells and returned home — confirming .
The figure below stacks these five rows top-to-bottom, one red cell per row marking where the single 1 sits.

L2.2 Trace a Johnson counter
Same register but the fed-back bit is complemented: (so takes each tick). Start at . List clocks 0 through 8 and the value that gets shifted into at each step.
Recall Solution
Apply the same shift rule, but now the incoming bit is (the complement of the rightmost cell):
| Clock | ||
|---|---|---|
| 0 | 0000 | 1 |
| 1 | 1000 | 0 |
| 2 | 1100 | 0 |
| 3 | 1110 | 0 |
| 4 | 1111 | 0 |
| 5 | 0111 | 1 |
| 6 | 0011 | 1 |
| 7 | 0001 | 1 |
| 8 | 0000 (repeat) | — |
Fill (4 steps) then empty (4 steps) = 8 states. Here "fill" means 1s enter at the end and build up leftward; "empty" means 0s enter at the end and push the 1s out toward .

L2.3 What comes after 1111?
In the 4-bit Johnson counter above, a student claims that after the register jumps to . Is that right? What is the actual next state?
Recall Solution
At the rightmost bit is , so the shifted-in bit is . One shift slides everything toward and pushes a single 0 into the end:
Not . The all-zero state appears only after all four 1s have been shifted out one at a time (clock 8). In figure s02 this is the transition from row "4 1111" to row "5 0111": exactly one red 0 has appeared at the left, nothing more.
Level 3 — Analysis
L3.1 Decode a Johnson state with one gate
For the 4-bit Johnson sequence, find a 2-input gate that outputs 1 for state and 0 for all other valid states.
Recall Solution
Key idea: in a Johnson counter the register is always "1s on one side, 0s on the other". So there is exactly one place where the pattern switches value — call it the boundary. The boundary sits between a different pair of adjacent cells in every single state, which is why one adjacent-pair test pins down one state.
Why the boundary is unique to each state — systematic argument. Using this page's sequence (fill states and empty states ), look at state . Its cells are : reading right-to-left the switch from 1 to 0 happens between and .
Walk the states and record which adjacent pair holds (a "0 sitting just left of a 1"):
| State | pair with |
|---|---|
| none (no 1s) | |
Each of these states has its 0-left-of-1 switch at a different index, so the pairs are distinct. The remaining valid states have their 1s on the left, so none of them has a 0 immediately left of a 1 — in particular none satisfies and . Therefore no valid state except has and simultaneously.
That gives the one-gate decode: A single 2-input AND with one input inverted — cheap and glitch-free. To decode any other state, just AND the two cells straddling its boundary (the 0-side inverted).
L3.2 Frequency at each output
A 4-bit Johnson counter is clocked at . What frequency appears at any one output ?
Recall Solution
Step 1 — how many of the states have ? Look down any single column of figure s02. Take (rightmost column): scanning clocks 0→7 its values are — high for exactly 4 of the 8 states. Take (leftmost column): — again high for exactly 4 of the 8. This is no accident: in a Johnson counter every cell spends the "fill" half of the cycle transitioning to 1 and staying 1, then the "empty" half transitioning to 0 and staying 0, so each output is high for exactly of the states and low for the other .
Step 2 — that means one full high-then-low period per whole cycle. Because each makes a single continuous block of 1s followed by a single continuous block of 0s per cycle, it completes exactly one up-and-down (one period) every time the counter runs through all states. The whole cycle is clock ticks long, so: So a Johnson counter divides the clock by . (A ring counter would divide by , giving MHz.) This is the Frequency Division use-case.
L3.3 Ring vs Johnson efficiency
Compare state utilisation for a ring and a Johnson counter, both with . Which wastes fewer states, and by what factor?
Recall Solution
With , . Johnson uses times as many of the available states, so it is twice as efficient. Both are still hugely wasteful versus a binary counter (100%) — the trade is silicon-for-simplicity and glitch-freedom.
Level 4 — Synthesis
L4.1 Design for a target cycle length
You need a counter that produces exactly 10 distinct output states, one flip-flop changing per clock, and decodable with 2-input gates. How many flip-flops, and ring or Johnson?
Recall Solution
Requirement "2-input decode + one-bit-per-clock" points to Johnson. Set : A 5-bit Johnson counter gives states, each decodable with a single 2-input gate. (A ring counter would need flip-flops to reach 10 states — twice the hardware — so Johnson wins here.)
L4.2 Detect a dead loop
A 4-bit Johnson counter powers up in the state . Trace three clocks (fed-back bit , pattern slides toward ). Does it ever join the valid cycle? Name what has happened.
Recall Solution
Shift rule: new leftmost bit , and every other cell copies its left neighbour.
- : shift in → .
- : shift in → .
- : shift in → .
- : shift in → ;
The trajectory wanders among unused patterns and never reaches any valid state (). This is a lock-out / dead loop — an unused-state cluster the counter can enter and cannot escape. Cured by making the counter self-starting.
L4.3 Verify a self-starting fix
For this page's Johnson wiring (feedback from , pattern slides toward ), a proposed self-correcting fed-back bit is (a) Check it still gives the correct next-input for the valid fill/empty states. (b) Audit all unused states to decide whether the fix truly makes the counter self-starting.
Recall Solution
Read the formula with the Boolean symbols from the notation box: is 1 only when is 1 AND ( OR ) is 1. The register updates as , , , .
(a) Valid states are untouched. Compute for each valid state and compare to the plain :
| State | plain | |||||
|---|---|---|---|---|---|---|
| 0000 | 1 | 0 | 1 | 1 | 1 | 1 ✓ |
| 1000 | 1 | 1 | 1 | 1 | 1 | 1 ✓ |
| 1100 | 1 | 1 | 1 | 1 | 1 | 1 ✓ |
| 1110 | 1 | 1 | 0 | 1 | 1 | 1 ✓ |
| 1111 | 0 | 1 | 0 | 1 | 0 | 0 ✓ |
| 0111 | 0 | 0 | 0 | 0 | 0 | 0 ✓ |
| 0011 | 0 | 0 | 0 | 0 | 0 | 0 ✓ |
| 0001 | 0 | 0 | 1 | 1 | 0 | 0 ✓ |
Every valid state gives the same as plain → the normal cycle is preserved. ✓
(b) Full unused-state audit. The 8 unused states are . For each, compute , then form the next state (leftmost is the new bit, the rest are the old shifted right):
| Unused | next | lands in… | |||
|---|---|---|---|---|---|
| 0010 | 1 | 1 | 1001 | unused | |
| 0100 | 1 | 1 | 1010 | unused | |
| 0101 | 0 | 0 | 0010 | unused | |
| 0110 | 1 | 0 | 0011 | valid ✓ | |
| 1001 | 0 | 0 | 0100 | unused | |
| 1010 | 1 | 1 | 1101 | unused | |
| 1011 | 0 | 0 | 0101 | unused | |
| 1101 | 0 | 0 | 0110 | → then valid |
Trace each chain forward to see where it ends: Every one of the eight unused states eventually funnels into the valid state and rejoins the main cycle. So this feedback is self-starting: no matter which state the counter powers up in, it recovers into the legal count within a few clocks. (Contrast L4.2, where plain feedback left the counter trapped forever.)
Level 5 — Mastery
L5.1 Full unused-state audit
A 4-bit Johnson counter uses 8 of the possible states. (a) How many unused states are there? (b) List them.
Recall Solution
(a) unused states. (b) The 8 valid states are . Every other 4-bit pattern is unused: Count: 8 patterns. ✓ Each of these is a candidate power-up state that a self-starting design must route back into the valid cycle.
L5.2 Divide-by-a-prime
Design a divide-by-7 frequency divider using a shift-register counter, single-bit transitions, minimal flip-flops. Give , the type, and confirm the output frequency for .
Recall Solution
Divide-by-7 needs 7 states. Johnson gives (always even) — never 7. Ring gives (any integer) — so use a ring counter with flip-flops, preset with a single 1. A ring counter is the natural choice for odd division factors; Johnson only reaches even factors .
L5.3 Grand comparison
Fill in the divide ratio and flip-flop count for each counter type to divide a clock by 12, one-bit-per-tick where possible. Then sketch the glitch a binary counter would introduce.
Recall Solution
- Johnson: flip-flops. One bit changes per clock ✓. Divide-by-12 with 6 FFs.
- Ring: flip-flops for 12 states. One bit changes per clock ✓ but twice the hardware.
- Binary (synchronous): flip-flops, but needs modulus logic and multiple bits flip per tick → decoding glitches.
Why the binary counter glitches — concrete example. Suppose a binary counter steps from (decimal 7) to (decimal 8). In an ideal world all four bits flip at the same instant. In reality each flip-flop has a slightly different propagation delay, so for a few nanoseconds the outputs may pass through intermediate patterns, e.g.
because the low bits fall before the high bit rises. A decoder watching for, say, pattern (decimal 6) would see a brief false pulse — a decoding glitch — even though the count "6" is not really being visited. See figure s03 below.

This is exactly the hazard (Glitches and Decoding Hazards) that ring/Johnson counters avoid by design: only one bit ever moves, so no phantom pattern can appear. For divide-by-12 with glitch-free single-bit transitions, the 6-flip-flop Johnson counter is the sweet spot.
[!recall]- Self-test recap
Ring states for
Johnson states for
State after Johnson (this page's wiring, slides toward )
Decode gate for Johnson
Johnson clock division by MHz,
Counter type for divide-by-7
Unused states in a 4-bit Johnson counter
Connections
- Ring and Johnson counters — the parent topic these exercises drill.
- Shift Registers — the base register being fed back.
- Flip-Flops (D type) — the storage cells.
- Frequency Division — L3.2, L5.2, L5.3 exploit divide-by- / .
- Self-starting Sequential Circuits — L4.2, L4.3, L5.1 lock-out and correction.
- Glitches and Decoding Hazards — why single-bit transitions matter (L3.3, L5.3).
- Synchronous Counters — the alternative compared in L5.3.