CSC213 ยท 2080 ยท 5 marks
What do you mean by error correction codes? Explain any one of error correction technique.
What do you mean by error correction codes? Explain any one of error correction technique. [5]
Quick answer
An error correction code is a binary code that not only detects errors that occur during data transmission but also corrects those errors automatically without requiring retransmission. Unlike error detection codes (such as parity bits) which can only indicate the presence of an error, error correction codes can identify the exact location of the erroneous bit and fix it.
Error Correction Codes
Definition
Hamming Code (Error Correction Technique)
Hamming Code is the most widely used error correction technique, developed by R.W. Hamming. It adds redundant bits (called parity bits) at specific positions to detect and correct single-bit errors.
Key Rules for Hamming Code
- Parity bits are placed at positions that are powers of 2: position 1, 2, 4, 8, 16, ...
- Each parity bit checks specific bit positions in the codeword.
- Data bits occupy the remaining positions.
Formula for Number of Parity Bits
If the data has m bits, the number of parity bits r must satisfy:
2^r >= m + r + 1
Worked Example
Encode the data bits: 1011
Step 1: Determine number of parity bits
- m = 4 (data bits)
- Try r = 3: 2^3 = 8 >= 4 + 3 + 1 = 8 โ
- So we need 3 parity bits
Step 2: Total bits = m + r = 4 + 3 = 7 bits
Step 3: Assign positions
| Position | 1 (P1) | 2 (P2) | 3 (D1) | 4 (P3) | 5 (D2) | 6 (D3) | 7 (D4) |
|---|---|---|---|---|---|---|---|
| Bit | P1 | P2 | 1 | P3 | 0 | 1 | 1 |
Data bits 1, 0, 1, 1 are placed at positions 3, 5, 6, 7 respectively.
Step 4: Calculate parity bits (using even parity)
-
P1 (position 1): checks positions 1, 3, 5, 7
- Bits: P1, 1, 0, 1 โ count of 1s = 2 (even) โ P1 = 0
-
P2 (position 2): checks positions 2, 3, 6, 7
- Bits: P2, 1, 1, 1 โ count of 1s = 3 (odd) โ P2 = 1
-
P3 (position 4): checks positions 4, 5, 6, 7
- Bits: P3, 0, 1, 1 โ count of 1s = 2 (even) โ P3 = 0
Step 5: Final Hamming Codeword
| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Bit | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
Transmitted codeword: 0110011
Error Detection and Correction
At the receiver, parity checks are recalculated. If an error occurs (say bit 5 flips from 0 to 1):
- The parity checks that fail are noted.
- Their position numbers are added to give the position of the erroneous bit.
- That bit is then flipped to correct the error.
Advantages of Hamming Code
- Corrects all single-bit errors
- Detects double-bit errors (with extended Hamming code)
- Efficient and widely used in memory systems (ECC RAM)
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.