Error
Error
Error
CORRECTION
Presented by
Surendra Kumar Saini
Error Detection and Correction
• Basic concept:
– Extra bits are added to the data bits that we want to represent, to get
codewords.
– Codewords are divided into two categories: valid codewords and invalid
codewords.
– A bit error changes a valid codeword to an invalid codeword.
• Definition:
– The distance between two codewords Ci and Cj, denoted by dist (Ci, Cj),
denotes the number of bit positions in which the codewords differ.
– Example: distance between codewords 01001 and 11100 is 3.
2
Valid Invalid
Codewords Codewords
3
Parity Code for Error Detection
• The parity of a given binary word is 3-bit Binary Parity
defined by whether the number of Word Bit
1’s is odd or even.
– We can add an extra bit, called parity 0 0 0 0
bit, to make the number if 1’s in 0 0 1 1
every valid codeword even (say).
– An example for 3-bit words is shown. 0 1 0 1
– Any odd number of bit errors can be 0 1 1 0
detected.
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
4
Hamming Code for Single Error Correction
5
b1 b2 b3 b4 b5 b6 b7
Example: Hamming Code
Dig p1 p2 m1 p3 m2 m3 m4
for BCD (m=4)
it p1 = m1 m2 m4 (1, 3, 5, 7)
0 0 0 0 0 0 0 0 p2 = m1 m3 m4 (2, 3, 6, 7)
1 1 1 0 1 0 0 1 p3 = m2 m3 m4 (4, 5, 6, 7)
2 0 1 0 1 0 1 0
3 1 0 0 0 0 1 1
1 2 3 4 5 6 7
4 1 0 0 1 1 0 0
p3 0 0 0 1 1 1 1
5 0 1 0 0 1 0 1
6 1 1 0 0 1 1 0 p2 0 1 1 0 0 1 1
7 0 0 0 1 1 1 1 p1 1 0 1 0 1 0 1
8 1 1 1 0 0 0 0
9 0 0 1 1 0 0 1
6
How to correct errors?
7
An Exercise
• Design a Hamming code for m = 5.
• For 2k ≥ m + k + 1, we get k = 4.
• The bit assignments are carried out as follows:
1 2 3 4 5 6 7 8 9
b1 b2 b3 b4 b5 b6 b7 b8 b9 p 0 0 0 0 0 0 0 1 1
p1 p2 m p3 m m m p4 m 4
1 2 3 4 5 p 0 0 0 1 1 1 1 0 0
3
p 0 1 1 0 0 1 1 0 0
2
p 1 0 1 0 1 0 1 0 1
1
8