Related Concepts: 2.01 BCD & Weighted Digital Codes | 2.02 Excess-3 Code & Self-Complementing Logic | 2.03 Gray Code & Code Conversions

2.04 Error Control, Parity Generators & Checkers

Error Control Concepts

During serial data transmission over noisy communication channels, electromagnetic interference can cause bit inversion errors { or }.

To safeguard data integrity, systems employ Error Control Codes by appending redundant check bits to transmitted data packets.


1. Error Detecting vs. Error Correcting Codes

Major Exam Theory Question (PYQ 2018 — 04 marks)

Question (verbatim): Explain the differences between error detecting codes and error correcting codes.

The 2017 paper instead asked you to simply “Define Error detection code” as one item inside a 10-mark multi-part definitions question.

ParameterError Detecting CodesError Correcting Codes
Primary FunctionDetects the presence of errors during transmission.Detects the error AND automatically determines its bit location to correct it.
Action on ErrorFlags error to receiver; requires retransmission.Automatically corrects error without requesting retransmission.
Redundancy OverheadLow overhead; requires few redundant bits {e.g., 1 parity bit}.High overhead; requires multiple redundant check bits {e.g., Hamming distance}.
Implementation ComplexitySimple hardware {cascaded XOR gates}.Complex logic {syndrome decoders & bit-flipping networks}.
Standard ExamplesParity bits, Checksums, CRC.Hamming Code, Reed-Solomon Code, BCH Code.

2. Parity Architecture & Operation

graph LR
    subgraph Transmitter End
        DataTx[Data Bits: x y z] --> GenXOR[Parity Generator Logic]
        GenXOR --> Packet[Transmitted Packet: x y z P]
    end
    
    Packet -->|Serial Channel| RxPacket[Received Packet: x' y' z' P']
    
    subgraph Receiver End
        RxPacket --> CheckXOR[Parity Checker Logic]
        CheckXOR -->|C = 0| NoError[No Error Detected]
        CheckXOR -->|C = 1| ErrorDet[Bit Error Flagged!]
    end

3. Even Parity Generator & Checker

  • Even Parity Rule: The parity bit is generated so that the total count of 1s in is always EVEN.
  • 3-Bit Generator (Transmitter):
  • 4-Bit Checker (Receiver):

3.1 Design: 4-Bit Even Parity Checker

Major Exam Design Problem (PYQ 2015, 2020, 2023, 2024 — 8 to 12 marks)

Question (verbatim): Design a combinational circuit to check for even parity of four bits. A logic-1 output is required when the four bits do not constitute an even parity.

Read the specification carefully. All four bits are received bits — this is not a 3-data-plus-1-parity split. The output must be 1 when the word fails the even-parity test, i.e. when the number of 1s is odd.

Step 1: Truth Table

No. of 1sParity
00000even0
00011odd1
00101odd1
00112even0
01001odd1
01012even0
01102even0
01113odd1
10001odd1
10012even0
10102even0
10113odd1
11002even0
11013odd1
11103odd1
11114even0

Step 2: K-Map — and Why It Refuses to Simplify

       CD
  AB \ 00   01   11   10
    +----+----+----+----+
 00 |  0 |  1 |  0 |  1 |
    +----+----+----+----+
 01 |  1 |  0 |  1 |  0 |
    +----+----+----+----+
 11 |  0 |  1 |  0 |  1 |
    +----+----+----+----+
 10 |  1 |  0 |  1 |  0 |
    +----+----+----+----+

Every 1 is surrounded on all four sides by 0s — a perfect checkerboard. No two 1s are ever adjacent, so no pair, quad or octet can be formed. The function is already minimal in SOP form, and that SOP needs eight 4-input AND gates plus an 8-input OR gate.

Step 3: The XOR Realisation

A checkerboard K-map is the visual signature of an XOR/XNOR function. Reading it as such:

This collapses ~9 gates down to three 2-input XOR gates cascaded:

  A ---+
       |--[ XOR ]---+
  B ---+            |
                    |--[ XOR ]---+
  C -----------------+           |
                                 |--[ XOR ]--- F
  D ------------------------------+

Exam Hack: Spot the Checkerboard Instantly

Any function whose minterms are the odd-parity set is an XOR chain; the even-parity set is an XNOR chain. You do not need to draw the K-map at all — but do draw it anyway, because “show that no grouping is possible” is where the marks for justifying the XOR form live.

Watch the polarity trap: if a paper instead says “logic-1 output when the bits DO constitute even parity”, the answer flips to , an XNOR chain. Four papers so far have used the “do not constitute” wording — read it twice.


4. Design: 3-Bit Odd Parity Generator & 4-Bit Checker

Major Exam Design Problem (PYQ 2022 — 08 marks; 2025 — 10 marks)

Question (verbatim, 2022): Derive the circuits for a three-bit parity generator and four-bit parity checker using an odd parity bit.

Part A: 3-Bit Odd Parity Generator (Transmitter)

  • Logic Rule: Generates such that total 1s in is ODD. If has an even number of 1s, must be 1.

Truth Table:

Input Message ()Generated Odd Parity Bit ()
0 0 01
0 0 10
0 1 00
0 1 11
1 0 00
1 0 11
1 1 01
1 1 10

Boolean Function:

The minterms for are — again a checkerboard, so this is the exact inverse of a 3-input XOR function {an XNOR, which outputs 1 when the count of 1s is even}:

Built as two 2-input XOR gates followed by an inverter (or an XOR feeding an XNOR).


Part B: 4-Bit Odd Parity Checker (Receiver)

  • Logic Rule: Evaluates received bits . If total 1s is EVEN, an error has occurred Error output .

Boolean Function:

Implemented by cascading three 2-input XOR gates followed by an inverter.

Generator vs. Checker — one gate apart

The odd-parity generator and the odd-parity checker are the same XNOR structure; the checker simply has one extra input (the received parity bit ). If you can draw one, you can draw the other in ten seconds. Compare against the even-parity checker in §3.1, which is a plain XOR chain with no inverter.


5. Critical Limitations of Parity Error Checking

Limitations of Simple Parity

  1. Odd-Bit Error Detection Only: Parity can ONLY detect an odd number of bit errors {1, 3, 5 flipped bits}.
  2. Fails on Even-Bit Errors: If an even number of bits flip {e.g., 2 bits change state}, total parity remains unchanged, and remains {error undetected}.
  3. No Correction Capability: Parity indicates that an error occurred, but cannot identify which bit flipped.

5.1 Differences: Parity Codes vs. Hamming Codes

FeatureSimple Parity CodesHamming Codes (e.g., 7-bit)
Primary CapabilityError detection only.Single-bit error detection AND correction.
Error Detection LimitDetects only odd numbers of bit errors (). Fails on even errors.Detects up to 2-bit errors (with SEC-DED), corrects 1-bit errors.
Error Correction LimitZero (requires retransmission).Corrects exactly one flipped bit.
Bit OverheadMinimal (exactly 1 parity bit added, regardless of data size).Higher ( parity bits for data bits, for data bits).
Syndrome Decoder ComplexityVery low (cascaded XOR/XNOR gates).Medium (decoder logic to calculate error position syndrome).
Typical Use CasesShort-distance transmission, memory buses.ECC memory, satellite communications, network packets.

6. Master Tutorial: 7-Bit Hamming Code Error Control

To overcome the limitations of simple parity, Richard Hamming developed a method to locate and correct a single-bit error by using overlapping parity sets.

6.1 Bit Allocation Schema

A 7-bit Hamming code contains 4 data bits () and 3 redundant parity bits (). The parity bits are positioned at indices that are powers of 2.

7-Bit Codeword Positions:
    1      2      3      4      5      6      7
+------+------+------+------+------+------+------+
|  P1  |  P2  |  D3  |  P4  |  D5  |  D6  |  D7  |
+------+------+------+------+------+------+------+
  2^0    2^1    Data   2^2    Data   Data   Data

The binary weight of each position determines which parity bits check it:

  • Position 3 () is checked by (LSB=1) and (middle=1).
  • Position 5 () is checked by (LSB=1) and (MSB=1).
  • Position 6 () is checked by (middle=1) and (MSB=1).
  • Position 7 () is checked by , , and .

6.2 Parity Generator (Transmitter End)

Assuming even parity, each parity bit is calculated by XORing the data bits in its check set:

  • checks positions with LSB = 1 ():
  • checks positions with middle bit = 1 ():
  • checks positions with MSB = 1 ():

Worked Example: Encode Data 1100 ()

Given data bits: .

  1. Calculate Parities:
  2. Construct Codeword:
    • (Bit 1)
    • (Bit 2)
    • (Bit 3)
    • (Bit 4)
    • (Bit 5)
    • (Bit 6)
    • (Bit 7)
    Codeword: 1100001

6.3 Parity Checker & Error Correction (Receiver End)

Upon receiving the 7-bit codeword, the receiver computes three check bits ():

The check bits form the Syndrome Word ():

  • Syndrome (Decimal 0): No error occurred during transmission.
  • Syndrome (Decimal ): A single-bit error occurred at bit position . To correct the error, simply invert bit .

Worked Example: Correcting a Bit Error

Suppose the received codeword is 1110001 (the 3rd bit flipped from 0 to 1 during transmission).

  1. Extract received bits:
    • .
  2. Calculate Check Bits:
  3. Evaluate Syndrome:
  4. Correction: Bit position 3 is incorrect. Flip Bit 3 () from 1 to 0. The corrected codeword is 1100001, and the recovered data is 1100.

7. Past Year Questions (PYQs)

PYQ Index for this note

Question (as asked)YearsMarksSolved in
Define error detection code (inside a multi-part definitions question)2017part of 10§Abstract, §1
Explain the differences between error detecting codes and error correcting codes20184§1
Design a combinational circuit to check for even parity of four bits; logic-1 when the bits do not constitute even parity2015, 2020, 2023, 20248–12§3.1
Derive circuits for a 3-bit parity generator and 4-bit parity checker using an odd parity bit2022, 20258–10§4

Pattern to notice: the 4-bit even-parity checker is one of the most repeated design questions in the whole paper — four appearances in ten years, worth up to 12 marks, and the wording never changes. It is also the cheapest to answer: truth table → checkerboard K-map → XOR chain. Roughly fifteen minutes of practice locks in a guaranteed block of marks.

The Hamming code material in §6 has not appeared in a past paper. It is included because it is the natural answer to “how would you correct rather than merely detect”, and because §5.1 compares the two — but do not spend heavy revision time on it before the repeated parity questions above are automatic.