3.3.10 · D2Combinational Circuits

Visual walkthrough — Parity generators - checkers

2,225 words10 min readBack to topic

This is the visual walkthrough of parity generation and checking. We start with nothing but light bulbs that are ON or OFF, and we slowly build the exact circuit that catches a flipped bit. Every symbol is drawn before it is used. Follow the pictures — the words only point at them.


Step 1 — What is a "bit" and what does "flip" mean?

WHAT. A bit is one tiny fact that can only be in two states. We draw it as a bulb: ON , OFF . A word is a row of these bulbs, e.g. is (ON, OFF, ON).

WHY. Every idea on this page is really just "how many bulbs are ON?". Before we can count, we must agree on what we are counting.

PICTURE. In the figure, the top row is the message the sender wants to send. The one bulb that got hit by noise (a lightning bolt) flips: it swaps ON↔OFF. That single swap is the enemy we want to detect.

Figure — Parity generators - checkers

Step 2 — Counting ON bulbs is hard; asking "is the count odd?" is easy

WHAT. We do not need the exact count of ON bulbs. We only need one yes/no fact: is that count odd? Call this fact the parity of the word.

WHY. A flip changes the count by . Adding or subtracting always turns an odd number even and an even number odd. So a flip always flips the parity — that is the property that will let us catch it. The full count carries more information than we need; parity is the cheapest thing that still notices a single flip.

PICTURE. The figure sorts words into two buckets: EVEN-many ON (left, violet) and ODD-many ON (right, magenta). Every lightning arrow crosses from one bucket to the other. There is no arrow that stays inside a bucket — that is the guarantee we will build on.

Figure — Parity generators - checkers

Step 3 — The gate that measures "odd count of two bulbs": XOR

WHAT. We need a machine that eats bulbs and outputs when an odd number are ON. Start with just two inputs. The gate that does this is XOR, written (the symbol is a plus inside a circle — read it "x-or"). See XOR and XNOR gates for the gate itself.

WHY XOR and not AND or OR? Look at what each gate really asks:

  • asks "are both ON?" — that is not a count of oddness.
  • asks "is at least one ON?" — this says for one ON and for two ON, so it cannot tell odd from even.
  • says for exactly one ON and for zero or two ON. One is odd, zero and two are even. That is literally "is the count odd?"

PICTURE. The figure draws all four input pairs as pairs of bulbs, with the XOR output beside each. The output lights up precisely on the two "one-ON" rows — the odd rows.

Figure — Parity generators - checkers

Step 4 — Chaining XORs: measuring oddness of MANY bulbs

WHAT. Real words have many bits. We feed them through a chain of XORs: Here each is one data bulb ( is just its position number, up to ), and is the single output bit at the end of the chain.

WHY it still means "odd?". XOR is associative — grouping does not matter, so we may fold the bits in one at a time, left to right. Each new bit either adds an ON (an extra ) or an OFF (nothing). Folding an OFF leaves the running answer alone; folding an ON toggles it. Toggling once per ON bulb means the final answer is ON exactly when an odd number of ON bulbs were folded in. So the word has an odd number of s. The two-input rule from Step 3 has grown into an -input rule for free.

PICTURE. The figure shows a staircase of XOR gates. Watch the running value on the wire between gates: it toggles every time an ON bulb enters, and holds steady when an OFF enters. The colour of the final wire tells you the parity.

Figure — Parity generators - checkers

Step 5 — The generator: choosing so the FULL word obeys a rule

WHAT. The sender adds one extra bulb (the parity bit) so that the full word obeys an agreed rule. For even parity, the rule is "total ON count is even". The choice is:

WHY exactly . Split the total ON count: .

  • If the data already has an even count, then , so — we add nothing, total stays even. ✓
  • If the data has an odd count, then , so — we add one more ON, odd = even. ✓

Both cases are captured by the single equation . It is not a coincidence; 's whole job is to cancel any oddness, and is precisely "how much oddness there is".

For odd parity, we want the total to be odd, so we need the opposite bit:

PICTURE. The figure takes the XOR-tree output and drops it in as the last bulb . Watch the total ON count of the padded word — it lands on EVEN every single time.

Figure — Parity generators - checkers

Step 6 — The checker: the SAME tree, one input longer

WHAT. The receiver gets the padded word and XORs everything, P included: is the error signal — one output bulb.

WHY it's the same circuit. Compare with Step 4: the checker is just the generator's XOR tree with one more input wire (for ). is the parity of the whole received word.

  • In an even-parity system a correct word has even ON count, so its parity is : means OK, means error.
  • In an odd-parity system a correct word has odd count: means OK, means error.

Why it catches a flip. From Step 2, a single flip jumps the word to the other bucket, i.e. flips the whole-word parity, i.e. flips . So a good becomes a screaming .

PICTURE. The figure lays the generator and checker side by side. They are the same staircase; the checker just has the wire feeding one extra gate. A red lightning bolt flips a bulb in the middle and you can watch flip from to .

Figure — Parity generators - checkers

Step 7 — Every case, including the degenerate ones

WHAT. We must show the checker for all scenarios, not just the happy one.

PICTURE. The figure is a small table of received words with their and verdict, spanning the corners:

Figure — Parity generators - checkers
received word ON count even-parity verdict
(correct) 2 (even) OK
(1 flip) 3 (odd) ERROR
(2 flips) 2 (even) "OK" — MISSED
(all off) 0 (even) OK
(all on) 4 (even) OK

WHY the cases matter:

  • All-zeros (): zero is an even number, so — a legitimately correct even word. The circuit does not choke on "nothing is on".
  • All-ones (): four ON is even, , OK. Both extremes behave.
  • Single flip: count changes by → odd → → caught. Always.
  • Double flip (the blind spot): two flips change the count by an even amount ( or ), so the bucket is restored, , and the error slips through. This is the fundamental limit: simple parity detects odd numbers of errors only, and it can never say which bulb moved — so it cannot correct. To locate/fix errors you need more redundancy: Hamming Codes, or stronger detectors like Checksums and CRC. See Error Detection and Correction for the ladder.

The one-picture summary

Figure — Parity generators - checkers

One tree of XOR gates does everything. Feed it the data bits and its output is (the generator). Feed it data bits plus and its output is (the checker). A flip crosses the even/odd bucket line and flips — caught. Two flips cross back — missed. That single figure is the entire topic.

Recall Feynman: retell the whole walkthrough

We have a row of light bulbs. All I care about is: is the number of glowing bulbs odd? Because if one bulb secretly flickers, that odd/even answer must change — one flip can only bump the count by one, and one bump always swaps odd↔even. To measure oddness I use XOR: an XOR gate glows when exactly one of its two inputs glows — that's "count is odd" for two bulbs. Chain them and it means "odd count" for any number of bulbs, because each ON bulb toggles the running answer. Before sending, I compute that answer and glue it on as a spare bulb , chosen so the total is even. My friend runs the very same XOR chain over everything I sent, including ; his answer should come out . If it comes out , a bulb flipped in transit — he doesn't know which, and if two flipped he's fooled, but for the common single glitch, he catches it every time. Same tree, two jobs: generate, then check.

Recall Quick self-test

Why XOR and not OR for parity? ::: OR says 1 for both "one ON" and "two ON", so it can't tell odd from even; XOR says 1 only for odd counts. A flip changes the ON count by how much, and why does that matter? ::: By , which always swaps even↔odd, so it always flips the parity signal . Even-parity checker: what does mean? ::: An error — a correct even word gives . Why is reported OK in even parity? ::: Zero is even, so the parity of an all-off word is — a valid correct word. Why are two flips missed? ::: They change the count by an even amount, restoring the original bucket, so is unchanged.

Connections

  • XOR and XNOR gates — the single gate this entire page is built from.
  • Parity generators - checkers — the parent topic; this page is its visual derivation.
  • Combinational Circuits — the XOR tree has no memory; output depends only on current inputs.
  • Error Detection and Correction — where parity sits on the reliability ladder.
  • Hamming Codes — many parity bits, arranged to locate the flipped bit.
  • Checksums and CRC — stronger successors that catch more error patterns.
  • Adders & Multiplexers — other combinational blocks that lean on XOR.