|
|
Hamming Code
Hamming code is one of the error-correcting codes that most commonly
used in RAMS. In this code, k parity bits are added to n-bit data word
to form a new word n + k bits, bit positions are numbered in sequence
from 1 to n + k. Their positions numbered as a power of 2 which provided
for parity bits, the bits of the rest is bits of data. The code can be
used with the words of any length. For example, 8 bits data word
11000100. We include 4 parity bits with the 8-bit data word arrange 12
bit set as follows:
|
Bit position |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
|
P1 |
P2 |
1 |
P4 |
1 |
0 |
0 |
P8 |
0 |
1 |
0 |
0 |
The 4 parity bits, P1, P2, P4 and P8, are in
positions 1, 2, 4, and 8, respectively. The 8 bits of the data word are
in the remaining position. Each parity bit is calculated as follows:
P1 = XOR of bits (3, 5, 7, 9, 11)
P2 = XOR of bits (3, 6, 7, 10, 11)
P4 = XOR of bits (5, 6, 7, 12)
P8 = XOR of bits (9, 10, 11, 12)
Then the stored 8-bit word data is (together
with 4 parity bits)
|
Bit position |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
|
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
|