3.4.9 · D2Sequential Circuits

Visual walkthrough — Ring and Johnson counters

2,078 words9 min readBack to topic

Step 1 — What is a single storage box (a flip-flop)?

WHAT. Before any counter, meet the smallest character in the story: one memory box called a flip-flop. It holds exactly one symbol — a or a — and it only changes at the instant a clock "ticks".

WHY this and not just a wire? A plain wire forgets instantly. We need something that remembers its bit between ticks so a pattern can be stored and shuffled around. The specific box we use is a D-type flip-flop: whatever sits on its input wire (called , for "Data") gets copied into memory on the tick, and shows up on its output wire (called ).

PICTURE. One box, its arrow coming in, its arrow going out, and the rule written on it.

Figure — Ring and Johnson counters

Step 2 — Chain the boxes: the bucket-brigade

WHAT. Line up boxes. Wire each box's output into the next box's input: , , . This is a shift register — a bucket-brigade that passes each stored bit one seat to the right per tick.

WHY wire them this way? Because "pass the bit along" is the only motion we want. On each tick, box 1 becomes whatever box 0 was, box 2 becomes whatever box 1 was, and so on. The whole pattern slides right by one.

Read each equation as "the box on the left of the arrow copies the box on the right at the next tick." Note nothing feeds yet — that dangling input is the decision that creates a counter.

PICTURE. Four boxes with the chain arrows, and one lonely unconnected on the far left waiting for a wire.

Figure — Ring and Johnson counters

Step 3 — Close the loop → a ring counter

WHAT. Fill the dangling by looping the last output straight back to the first input:

Here is "what the rightmost box shows now"; is "what the leftmost box becomes next." So the bit that falls off the right end reappears on the left. Now nothing leaks out — the pattern circulates forever. That closed loop is the ring counter.

WHY the straight wire (no changes)? Because we want the same bit to travel around unchanged, like one glowing ball handed in a circle. If exactly one box holds a and the rest hold , that just orbits.

PICTURE. The chain from Step 2 bent into a loop, with the feedback wire highlighted (burnt orange) from back to .

Figure — Ring and Johnson counters

Step 4 — Watch the ring count → the number appears

WHAT. Inject a single (state , meaning ) and turn the crank. Each tick slides the lone one seat right; when it falls off the right it re-enters on the left.

WHY does the answer come out ? Count the distinct pictures. There are exactly seats where the single can sit — one per box. After ticks it has visited every seat and come home. So the cycle length equals the number of boxes:

Each symbol: = how many states before it repeats; = number of flip-flops. They are equal because "one hot bit in seats" has exactly arrangements.

PICTURE. The four legal states drawn as four rows of lamps; the single lit lamp marches diagonally, arrow looping back to the top.

Figure — Ring and Johnson counters

Step 5 — Add the twist → a Johnson counter

WHAT. Change one wire. Instead of feeding back, feed its complement (its opposite) back:

The bar over means "flip it": if then , and if then . So the bit that comes around the loop enters inverted. This one inverter turns the ring into a Johnson counter (a "twisted ring").

WHY does flipping the feedback change everything? Because now the register no longer recirculates a fixed pattern — it reacts to its own tail. When the rightmost box is empty (), the loop keeps pushing s in. Once the rightmost box fills (), the loop switches to pushing s in. So the register fills up, then empties out — a two-phase breathing motion instead of a spin.

PICTURE. Same loop as Step 3, but a plum inverter triangle sits in the feedback wire; a call-out shows " inject 1" vs " inject 0."

Figure — Ring and Johnson counters

Step 6 — Watch Johnson fill → the number (first half)

WHAT. Start empty (). While , feedback injects s from the left. Watch the s pile up:

WHY exactly ticks to fill? There are boxes, and each tick lights one more from the right side. Going from " ones" to "all ones" therefore takes exactly ticks. Right when we hit , the rightmost box is , so — the machine is about to reverse.

PICTURE. Four rows , lamps lighting one-per-row from the right, a teal "+1 lamp each tick" annotation.

Figure — Ring and Johnson counters

Step 7 — Watch Johnson empty → the other → the total

WHAT. Now so feedback injects s. The register drains from the left:

We are back to , where it all began — one full cycle done.

WHY does the grand total come out ? Add the two phases:

Each symbol: the first = ticks to fill, the second = ticks to empty, = total distinct states per cycle. The twist (the inverter) is precisely what gives you a second set of patterns for free — the same silicon, double the states.

PICTURE. Four rows , lamps going dark one-per-row from the left, with the fill-half greyed above so you see all states stacked.

Figure — Ring and Johnson counters

Step 8 — The degenerate & danger cases (never leave a gap)

WHAT. Two failure modes the happy path hides:

  1. Ring stuck at zero. If a ring counter powers up as , then and every box copies a forever. Dead. It cannot create a — feedback only copies. Fix: preset exactly one at power-on.
  2. Johnson dead loop. If a Johnson counter powers up in an unused pattern like , trace it: , shift , then , shift . It ping-pongs forever, never joining the real cycle.

WHY show this? Because a real chip will land in a random state at power-up. The clean / cycles are only some of the patterns; the leftovers ( of them) must be accounted for.

Fix. Make the counter self-starting: modify the feedback so every illegal state is forced back onto the legal ring (see Self-starting Sequential Circuits). For the 4-bit Johnson, a classic correction is , which routes strays like into a legal state within a few ticks.

PICTURE. Left: ring frozen at (all lamps dark, self-loop arrow). Right: the dead loop drawn as a two-node island, disconnected from the main 8-state ring.

Figure — Ring and Johnson counters

The one-picture summary

One diagram compresses the whole story: the same -box register, the same "slide right" motion — the only difference is whether the feedback wire is straight (, a ring of states) or inverted (, a twisted ring of states). Straight loop ⇒ a lone bit orbits. Twisted loop ⇒ fill then empty.

Figure — Ring and Johnson counters
Recall Feynman retelling — say it back in plain words

Picture four cups in a row, and a rule: every tick, each cup grabs whatever its left neighbour had. That's just passing water rightward — a shift register.

Ring: connect the last cup's water straight back to the first. Put water in one cup only. Now that splash marches right, falls off the end, reappears at the start — round and round. Four cups ⇒ four possible spots ⇒ four states. That's .

Johnson: same setup, but the last cup passes the opposite of what it holds. When the last cup is dry it keeps sending water in, so the row fills up from the right — that's ticks. The moment it's completely full, the last cup is wet, so now it sends dryness in, and the row empties from the left — another ticks. Fill four, empty four ⇒ eight states. That's , all from adding one little "flip it" gate.

Two warnings: an empty ring stays empty forever (you must drop in that first splash by hand), and a Johnson counter can get stuck sloshing if it wakes up wrong — so you wire in a correction that shoves it back home.

[!recall]- Quick self-test

Ring counter, boxes — how many states and why?
, because one hot bit has exactly seats to sit in.
Johnson counter, boxes — how many states and why?
: ticks to fill + ticks to empty, because the inverted feedback flips injection direction at full/empty.
What single wire change converts ring → Johnson?
Put an inverter in the feedback: instead of .
Why can't a ring counter start itself from ?
Feedback only copies existing bits; with all s, forever — no bit to circulate.
What follows Johnson state ?
, since shifts a into the left.

Connections

  • Ring and Johnson counters — the parent topic this walkthrough derives.
  • Shift Registers — the bucket-brigade of Steps 1–2.
  • Flip-Flops (D type) — the single memory box of Step 1.
  • Self-starting Sequential Circuits — the lock-out fix of Step 8.
  • Frequency Division — ring divides clock by , Johnson by (the cycle lengths we derived).
  • Glitches and Decoding Hazards — why one-bit-at-a-time transitions matter.