|
|
Detecting Error Using Hamming Code
When the 12-bits data are read from the memory then be evaluated by
follows
C1 = XOR of bits (1,3,5,7,9, 11)
C2 = XOR of bits (2,3,6,7,10,11)
C4 = XOR of bits (4,5,6,7,12)
C8 = XOR of bits (8,9,10,11,12)
then C in arrangement C=C8C4C2C1
be evaluated, if C=0000, indicates that no error has occured.
For example,
|
Bit position |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
status |
|
|
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
No
error |
|
|
1 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
Error
in bit 1 |
|
|
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
Error
in bit 5 |
Evaluating the XOR of the corresponding bits, we determine the 4 check
bits to be as follows:
C8 C4 C2 C1
For no errorr : 0 0
0 0
With error in bit 1 : 0 0 0
1
With error in bit 5 : 0 1 0
1
The Hamming code can detect and correct only a single error. By adding
another parity bit to the coded word, the Hamming code can be used to
correct a single error and detect double errors. If we include this
additional parity bit, then the previous 12-bi t coded word becomes
0011 1001 0100P13, where P13 is evaluated from the
exclusive-OR of the other 12 bits. This produces the 13-bit word
0011100101001(even parity). When the 13-bit word is read from memory,
the check bits are evaluated, as is the parity P over the entire 13
bits. If P = 0, the parity is correct (even parity), but if P = 1, then
the parity over the 13 bits is incorrect (odd
parity). The following four cases can arise:
If C = 0 and P = 0, no error occurred.
If C # 0 and P = 1, a single error occurred that can be corrected.
If C # 0 and P = 0, a double error occurred that is detected, but that
cannot be corrected.
If C = 0 and P = 1, m error occurred in the P13 bit.
Source:
Digital Design, M.Morris Mano
|