| FazBrowse Wikipedia Viewer | Main Page | | |
| Viewing: https://en.wikipedia.org/wiki/Hamming_code |
| Contents |
|---|
| Two-out-of-five code |
| Repetition |
| General algorithm |
| Hamming codes with additional parity (SECDED) |
| [7,4] Hamming code |
| Encoding |
| Binary Hamming codes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Hamming(7,4) code (with r = 3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Named after | Richard W. Hamming | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Classification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Type | Linear block code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Block length | 2 − r − 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Rate | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Notation | n = 2 − 1 and message length ''r''</sup> − ''r'' − 1"}},"i":0}}]}'/>k = 2 − r − 1. Hence the rate of Hamming codes is ''r''</sup> − 1)"}},"i":0}}]}'/>R = k / n = 1 − r / (2 − 1), which is the highest possible for codes with minimum distance of three (i.e., the minimal number of bit changes needed to go from any code word to any other code word is three) and block length ''r''</sup> − 1"}},"i":0}}]}'/>2 − 1. The parity-check matrix of a Hamming code is constructed by listing all columns of length
Parity adds a single bit that indicates whether the number of ones (bit-positions with values of one) in the preceding data was even or odd. If an odd number of bits is changed in transmission, the message will change parity and the error can be detected at this point; however, the bit that changed may have been the parity bit itself. The most common convention is that a parity value of one indicates that there is an odd number of ones in the data, and a parity value of zero indicates that there is an even number of ones. If the number of bits changed is even, the check bit will be valid and the error will not be detected. Moreover, parity does not indicate which bit contained the error, even when it can detect it. The data must be discarded entirely and re-transmitted from scratch. On a noisy transmission medium, a successful transmission could take a long time or may never occur. However, while the quality of parity checking is poor, since it uses only a single bit, this method results in the least overhead. Two-out-of-five codeeditRepetitioneditHamming was interested in two problems at once: increasing the distance as much as possible, while at the same time increasing the code rate as much as possible. During the 1940s he developed several encoding schemes that were dramatic improvements on existing codes. The key to all of his systems was to have the parity bits overlap, such that they managed to check each other as well as the data. General algorithmeditThe following general algorithm generates a single-error correcting (SEC) code for any number of bits. The main idea is to choose the error-correcting bits such that the index-XOR (the XOR of all the bit positions containing a 1) is 0. We use positions 1, 10, 100, etc. (in binary) as the error-correcting bits, which guarantees it is possible to set the error-correcting bits so that the index-XOR of the whole message is 0. If the receiver receives a string with index-XOR 0, they can conclude there were no corruptions, and otherwise, the index-XOR indicates the index of the corrupted bit. An algorithm can be deduced from the following description:
If a byte of data to be encoded is 10011010, then the data word (using _ to represent the parity bits) would be __1_001_1010, and the code word is 011100101010. The choice of the parity, even or odd, is irrelevant but the same choice must be used for both encoding and decoding. This general rule can be shown visually:
Shown are only 20 encoded bits (5 parity, 15 data) but the pattern continues indefinitely. The key thing about Hamming codes that can be seen from visual inspection is that any given bit is included in a unique set of parity bits. To check for errors, check all of the parity bits. The pattern of errors, called the error syndrome, identifies the bit in error. If all parity bits are correct, there is no error. Otherwise, the sum of the positions of the erroneous parity bits identifies the erroneous bit. For example, if the parity bits in positions 1, 2 and 8 indicate an error, then bit 1+2+8=11 is in error. If only one parity bit indicates an error, the parity bit itself is in error. With 2m−m−1 bits remain for use as data. As n=2m−1 |
(2m−m−1)/(2m−1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Hamming codes have a minimum distance of 3, which means that the decoder can detect and correct a single error, but it cannot distinguish a double bit error of some codeword from a single bit error of a different codeword. Thus, some double-bit errors will be incorrectly decoded as if they were single bit errors and therefore go undetected, unless no correction is attempted.
To remedy this shortcoming, Hamming codes can be extended by an extra parity bit. This way, it is possible to increase the minimum distance of the Hamming code to 4, which allows the decoder to distinguish between single bit errors and two-bit errors. Thus the decoder can detect and correct a single error and at the same time detect (but not correct) a double error. If the decoder does not attempt to correct errors, it can reliably detect triple bit errors. If the decoder does correct errors, some triple errors will be mistaken for single errors and "corrected" to the wrong value. Error correction is therefore a trade-off between certainty (the ability to reliably detect triple bit errors) and resiliency (the ability to keep functioning in the face of single bit errors).
For k data bits, a SECDED scheme requires:
This extended Hamming code was popular in computer memory systems, starting with IBM 7030 Stretch in 1961, where it is known as SECDED (or SEC-DED, abbreviated from single error correction, double error detection). Common forms for memory systems include (39,32) and (72,64). (While it is more efficient to use a codeword length in the form of 2 - 1, existing computer data word sizes being powers of 2 preclude this choice, though communication and data storage system do take advantage.) Server computers in 21st century, while typically keeping the SECDED level of protection, no longer use Hamming's method, relying instead on the designs with longer codewords (128 to 256 bits of data) and modified balanced parity-check trees. The (72,64) Hamming code is still popular in some hardware designs, including Xilinx FPGA families.
and 𝐆 and the parity-check matrix 𝐇:=(110110010110100111001)3,7.
Finally, these matrices can be mutated into equivalent non-systematic codes by the following operations:
From the above matrix we have 2 = 2 = 16 codewords. Let x→ for any of the 16 possible data vectors a→=[1,0,1,1]. Using the generator matrix 𝐆:=(11100001100110010101010111010010)4,8
and
| View original on Wikipedia | Back | FazBrowse Home |