Worked examples — Ring and Johnson counters
This page is the worked-examples drill for Ring and Johnson counters. Here we grind through every kind of case these counters can throw at you, so no exam question surprises you.
Before anything, one word we lean on constantly:
Look at s01: it shows one board holding , with arrow entering the end and the shift direction drawn explicitly. Use it to fix "which box is which" in your head before reading any trace below.


Ring: . Johnson: (the same wire, but passed through an inverter — a gate that turns 1 into 0 and 0 into 1).
The scenario matrix
Every question about these counters lands in one of these cells. Each cell gets at least one full example below.
| # | Case class | What makes it tricky | Example |
|---|---|---|---|
| A | Ring, valid start, normal cycle | baseline — list all states | Ex 1 |
| B | Ring, degenerate start = all-zeros | the "stuck" case | Ex 2 |
| C | Ring, two 1s injected by accident | wrong number of hot bits | Ex 3 |
| D | Johnson, valid start, fill-then-empty | the twist doubles states | Ex 4 |
| E | Johnson, decode one state with a 2-gate | uniqueness of adjacent bits | Ex 5 |
| F | Johnson, garbage / unused start | dead-loop lock-out | Ex 6 |
| G | Johnson, self-starting fix | forcing recovery | Ex 7 |
| H | Frequency-division real-world word problem | ring ÷n, Johnson ÷2n | Ex 8 |
| I | Limiting / exam twist: efficiency as | utilisation collapses | Ex 9 |
| J | Exam twist: given a state, which comes next? | sign of the feedback bit | Ex 10 |
[!example] Ex 1 — Cell A: 4-bit ring, valid start
Preset a 4-bit ring counter to . List the full cycle and its length.
Forecast: guess how many distinct states before it repeats.
- Write the feedback. . Why this step? The whole behaviour is decided by which output wraps to the input — for a ring it is the straight (uncomplemented) last output.
- Apply the shift rule once. Current string : , drop the left char, append → . Why this step? The shift rule is our single mechanical recipe — the leftmost box leaves and the feedback bit enters at the right () end.
- Keep applying the rule. : → . Then : → . Then : → . Why this step? Each new state comes from the previous by exactly the same drop-and-append, so the single 1 walks along the boxes.
- Full cycle: . Why this step? After returning to the sequence repeats, so this is the whole cycle.
- Count distinct states: = 4 states. Why this step? One 1 in boxes has exactly positions.
Verify: length . ✓ Only one flip-flop is 1 in every row (a hot-one code), consistent with a ring. Diagram s03 draws the single 1 walking one position each clock.

Read s03 as the same four strings above, laid out clock-by-clock: notice the lone lit lamp advances one box per row and the red arrow shows wrapping back to become the next .
[!example] Ex 2 — Cell B: 4-bit ring, degenerate start
A technician forgets to preset. The register powers up as . What does the counter do?
Forecast: does it eventually start counting on its own?
- Feedback value. . Why this step? With no 1 anywhere, the last output is 0, so the only bit entering is 0.
- Apply the shift rule. drop left char, append : . Why this step? Every box copies its neighbour (all 0) and feedback delivers a 0. Nothing can change.
- Conclusion: the counter is stuck at forever. Why this step? A plain ring can only copy existing bits — it cannot create the circulating 1.
Verify: cycle length here (a fixed point), not . This is exactly why a ring must be preset with one 1 before use. ✓
[!example] Ex 3 — Cell C: ring with two 1s injected
Noise loads into a 4-bit ring. Trace it.
Forecast: does it self-clean back to a single 1?
- Apply the shift rule. ; drop left char, append : . Why this step? Both 1s move up one index together and the fed-back 1 enters at .
- Apply again. ; . Why this step? Now the entry point receives a 0 from feedback while the pattern shifts.
- Loop. forever — a 2-state dead loop with the wrong number of hot bits. Why this step? A ring conserves the count of 1s; two 1s never merge into one.
Verify: number of 1s stays 2 throughout — the ring can never leave this sub-cycle. This shows a ring is not self-correcting for wrong-hot-count faults; it needs explicit re-preset. ✓
[!example] Ex 4 — Cell D: 4-bit Johnson, valid start
Now feed back the complement: . Start at . List the cycle.
Forecast: how many states — 4, 8, or 16?
- First feedback bit. . Why this step? The inverter turns the last box's 0 into a 1, so a 1 is about to enter at — unlike the ring, an empty Johnson feeds itself.
- Fill phase (shift rule, ). (four shifts, 1s stream in from the end). Why this step? While , the fed-in bit stays 1, so ones pile up.
- Flip point. At , . Why this step? Once the last box is 1, the inverter now injects 0s — the twist reverses the fill.
- Empty phase. (four more shifts). Why this step? Zeros stream in from the end until every 1 has shifted out, closing the cycle.
- Count: fill empty states. Why this step? Fill takes steps, empty takes steps.
Verify: length . ✓ Note (not ): zero appears only after every 1 shifts out. Follow s04 to see the register fill up then drain.

Read s04 row by row: the top four rows (clk 0–4) show lamps lighting one at a time (fill), the red arrow marks the flip point, and the bottom four rows (clk 4–8) show them going dark one at a time (empty) — exactly the eight strings from step 2 and step 4.
[!example] Ex 5 — Cell E: decode a Johnson state with a 2-input gate
From Ex 4, build a signal that is high only in state .
Forecast: how many inputs does the AND gate need?
- List all 8 states, look at neighbours . In the fill/empty cycle only has the pattern (the single " boundary"). Why this step? Every Johnson state has exactly one place where bits change from 0 to 1 or 1 to 0; that boundary position is a fingerprint.
- Write the decode term: . Why this step? A 2-input AND that is high when and matches only that unique boundary.
- Check the seven OTHER states. The seven non-target valid states are — none has with . Since only does satisfy it, the term fires for exactly one state. Why this step? Listing all seven non-target states and confirming each fails proves uniqueness by exhaustion.
Verify: exactly one of the eight states makes , and it is the target . Because only one flip-flop changes per clock, the term is also glitch-free — no momentary false 1 during transitions. ✓
[!example] Ex 6 — Cell F: Johnson garbage start (lock-out)
The 4-bit Johnson powers up in an unused state . Trace it, and account for all unused states.
Forecast: does it ever join the valid 8-state cycle?
- Apply the shift rule. State : MSB so ; drop the left char, append → ? Recompute the append carefully — the rule appends giving . But we must also track that the next feedback depends on the new MSB. Using the plain shift rule consistently: . Why this step? We use the exact same drop-and-append recipe as every other example; no special case is invoked.
- Apply again. State : so ; drop left char, append → . Why this step? Same recipe on the new string.
- Continue until it settles. : → . Then : → . Then : → , which is a valid state. Why this step? Following the rule far enough shows where a garbage state eventually lands.
- Account for the unused states (precision fix). A 4-bit register has patterns: valid unused. Tracing each unused state shows they are transient — every one, after one or more clocks, feeds into the valid 8-state cycle for this plain-Johnson wiring; there is no isolated dead loop here. Why this step? The honest statement is "8 unused states, all transient into the main cycle," which we confirm by exhaustive trace rather than assuming a trap exists.
Verify: unused count ; tracing reaches valid in five clocks, and no unused state maps only among unused states. So this particular plain-Johnson wiring happens to recover from every garbage start. ✓ The danger case (a genuine dead loop) is what Ex 7 designs against.
[!example] Ex 7 — Cell G: derive a self-starting fix
Some Johnson wirings do trap garbage in a dead loop. Design a feedback law whose corrector leaves the valid cycle untouched but is guaranteed to push any garbage state toward the valid cycle.
Forecast: can one extra gate rescue a garbage orbit without breaking the valid cycle?
- State the goal precisely. We want for every valid state (so the normal 8-state cycle is unchanged) and for at least one state of any garbage orbit (so an injected knocks it out). Why this step? A self-correcting design must preserve all good behaviour and only alter bad states.
- Read the valid states' . The 8 valid states are . Check the condition " or " on each: . Why this step? We must find a condition true on every valid state; shows the naive OR is not yet safe.
- Fix the failing valid state. State has , so its feedback makes regardless of — the corrector cannot corrupt it. So we only need on valid states whose , i.e. states with : — and the OR condition holds for all four. Why this step? The corrector only matters when ; on states the product is 0 anyway, so those are automatically safe.
- Adopt the law and trace a garbage state. Take , so . Trace garbage (): , so ; shift . Then (): ; shift , a valid state. Why this step? Injecting a at the right moment nudges the pattern off any bad orbit into the good cycle.
- Confirm the valid cycle is untouched. (): , ; shift — identical to plain Johnson. Why this step? Because on the valid states and the product is 0 on the valid states anyway, the full 8-state cycle is preserved.
Verify: garbage (valid), and valid unchanged. The counter is now self-correcting. ✓ (See Self-starting Sequential Circuits.)
[!example] Ex 8 — Cell H: frequency-division word problem
A 10 MHz clock drives a 6-bit ring and separately a 6-bit Johnson. You tap one flip-flop's output. What frequency comes out of each?
Forecast: which gives the lower output frequency?
- Ring output period. Any single flip-flop is high for 1 clock out of , so it produces one pulse every 6 clocks. Why this step? A ring divides frequency by its state count, .
- Ring frequency: . Why this step? Frequency ÷ number of states = output rate.
- Johnson state count . Why this step? The twist doubles the cycle, so one full waveform on any flip-flop spans 12 clocks.
- Johnson frequency: . Why this step? Same ÷-by-states rule, now with .
Verify: MHz, MHz; Johnson gives exactly half the ring's output — matching "ring ÷n, Johnson ÷2n". ✓ (See Frequency Division.)
[!example] Ex 9 — Cell I: limiting behaviour of efficiency
As , what happens to Johnson state utilisation ? Compute it at and describe the trend.
Forecast: does the fraction grow, shrink, or level off?
- At : (50%). Why this step? Plug in to see a concrete anchor.
- At : (6.25%). Why this step? Doubling multiplies numerator by 2 but denominator by ~16.
- Limit: numerator grows linearly, denominator grows exponentially, so . Why this step? Exponential always outruns linear — the counter wastes almost all its states for large .
Verify: , ; strictly decreasing toward 0. You "buy" glitch-free simplicity by throwing away exponentially many states. ✓ s05 plots this collapse for both ring and Johnson.

Read s05: the lavender curve (Johnson ) and mint curve (ring ) both plunge toward the axis as grows; the annotated points at (0.5) and (0.0625) are the two numbers you just computed.
[!example] Ex 10 — Cell J: exam twist "which state comes next?"
A 4-bit Johnson counter shows . Give the next state and the state after that.
Forecast: is the next bit fed in a 0 or a 1?
- Read . In , . Why this step? The feedback bit is , so we must know 's value first.
- Feedback bit . Why this step? The complement of the last output decides whether we are filling (1) or emptying (0).
- Apply the shift rule, inject 0 at : . Why this step? Every bit moves up one index; the new is the 0 we just computed.
- Repeat from : , shift . Why this step? Still in the empty phase, so another 0 enters.
Verify: matches the empty phase of the Ex 4 cycle exactly. ✓
[!recall]- Self-test
Ring next state?
Ring next state?
Johnson next state?
Decode gate for Johnson ?
6-bit Johnson from 10 MHz gives?
Johnson utilisation as ?
Johnson next state?
Self-starting corrector for Johnson?
Connections
- Parent topic — the concepts these examples drill.
- Shift Registers — the shift-right mechanic every example uses.
- Flip-Flops (D type) — each box is a D flip-flop copying on the clock.
- Glitches and Decoding Hazards — why Ex 5's single-bit-change decode is safe.
- Self-starting Sequential Circuits — Ex 6 & Ex 7 lock-out and recovery.
- Frequency Division — Ex 8's ÷n and ÷2n results.
- Synchronous Counters — contrast: full range but multi-bit hazards.