CRC N Hamming
CRC N Hamming
CRC N Hamming
Thus, error detection and correction is critical to accurate data transmission, storage and retrieval.
Longer data streams require more economical and sophisticated error detection mechanisms. Cyclic redundancy checking (CRC) codes provide error detection for large blocks of data.
You will fully understand why modulo 2 arithmetic is so handy after you study digital circuits in Chapter 3.
As with traditional division, we note that the dividend is divisible once by the divisor. We place the divisor under the dividend and perform modulo 2 subtraction.
Now we bring down the next bit of the dividend. We see that 00101 is not divisible by 1101. So we place a zero in the quotient.
Thus, to provide data integrity over the long term, error correcting codes are required.
Because the mathematics of Hamming codes is much simpler than Reed-Soloman, we discuss Hamming codes in detail.
The minimum Hamming distance for a code is the smallest Hamming distance between all pairs of words in the code.
Thus, a Hamming distance of 2k + 1 is required to be able to correct k errors in any data word.
Hamming distance is provided by adding a suitable number of parity bits to a data word.
(n + 1) 2 m 2 n
Because n = m + r, we can rewrite the inequality as:
(m + r + 1) 2 m 2 m + r or (m + r + 1) 2 r
This inequality gives us a lower limit on the number of check bits that we need in our code words.
1 (= 20) contributes to all of the odd-numbered digits. 2 (= 21) contributes to the digits, 2, 3, 6, 7, 10, and 11. . . . And so forth . . .
Bit 1checks the digits, 3, 5, 7, 9, and 11, so its value is 1. Bit 4 checks the digits, 5, 6, 7, and 12, so its value is 1. Bit 8 checks the digits, 9, 10, 11, and 12, so its value is also 1.
Using the Hamming algorithm, we can not only detect single bit errors in this code word, but also correct them!
Suppose an error occurs in bit 5, as shown above. Our parity bit values are:
Bit 1 checks digits, 3, 5, 7, 9, and 11. Its value is 1, but should be zero. Bit 2 checks digits 2, 3, 6, 7, 10, and 11. The zero is correct. Bit 4 checks digits, 5, 6, 7, and 12. Its value is 1, but should be zero. Bit 8 checks digits, 9, 10, 11, and 12. This bit is correct.
We have erroneous bits in positions 1 and 4. With two parity bits that dont check, we know that the error is in the data, and not in a parity bit. Which data bits are in error? We find out by adding the bit positions of the erroneous bits. Simply, 1 + 4 = 5. This tells us that the error is in bit 5. If we change bit 5 to a 1, all parity bits check and our data is restored.