Tricky Circuit

Even parity and its blind spot

Add one bit to spot some errors

Parity describes whether the number of 1 bits is even or odd. An even-parity bit is added so the data and check bit together contain an even number of 1s.

Open interactive experiment

EXPERIMENT BENCH

Change the circuit settings, predict the readings, then check a challenge. These are learning models, with the assumptions explained in each lesson.

Sign in to save progress. Guest progress stays on this device.

Open laboratory in a full window

Why it works

Ideal binary logic: 0 means low and 1 means high, not a measured voltage. Supply behavior, current, output loading and response delay are omitted; diagrams show functions, not chip pinouts.

b0, b1 and b2 are data bits; N counts their 1s. P is the appended parity bit: P = b0 ⊕ b1 ⊕ b2. ⊕ means XOR, Exclusive OR. N + P is always even. This experiment generates the bit; it does not simulate a noisy transmission.

Difficulty
  1. Build · Build it

    Power on with b0 = 1, b1 = 0 and b2 = 0. Get P = 1 and total 1-count 2.

    Need a hint?

    b0 = 1; b1 = 0; b2 = 0 → P = 1; N + P = 2

  2. Explore · Change the inputs

    Set b0 = 1, b1 = 1 and b2 = 0. Get P = 0 and total 1-count 2.

    Need a hint?

    b0 = 1; b1 = 1; b2 = 0 → P = 0; N + P = 2

  3. Solve it · Solve the challenge

    Set b0 = 1, b1 = 1 and b2 = 1. Get P = 1 and total 1-count 4.

    Need a hint?

    b0 = b1 = b2 = 1 → P = 1; N + P = 4

Extra reading and circuit recipes

Add one bit to spot some errors

Imagine attaching a tiny consistency check to a message. One extra bit helps a receiver notice an odd number of flipped bits, but cannot reconstruct the message.

N = b0 + b1 + b2; P = b0 ⊕ b1 ⊕ b2; N + P ∈ {0, 2, 4}

Set P to 1 for an odd data 1-count and to 0 for an even count. The appended bit fixes the count parity, not the value of the message.

A useful pattern

One flipped bit anywhere in the protected word, including its parity bit, makes even parity fail. An odd number of flips also fails.

Beyond the model

An even number of flips can preserve the check while changing the data. A single parity bit does not locate errors or correct them.

A useful trap to avoid

Passing parity does not prove the data is correct. Also, regenerating P after editing the inputs creates a new valid word; it is not checking the old transmitted word.

Two different bits flip in a word that had valid even parity. The check…

  1. must fail
  2. can still pass with wrong data
  3. corrects both bits
Read more

Two flips change the 1-count parity twice. It returns to even, so this check cannot detect that error pattern.

Build it

Set b0 = 1, b1 = 0, b2 = 0. One data 1 needs P = 1, giving two 1s overall.

N = 1; P = 1; N + P = 2

Change the inputs

Set all three data bits to 1. P = 1 gives four 1s overall.

N = 3; P = 1; N + P = 4

Try another path

Write down a valid data-plus-P word. On paper flip one bit, then two bits, keeping the original P unless it is one of the flipped bits. Check the total each time.

ti.com