

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concept of error control and detection using hamming code, a technique for detecting and correcting single errors in digital data transmission. The principles behind hamming code, the calculation of parity bits, and the process of error detection and correction.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


CS 140 Class Notes 3
1 Error Correction and Detection
A variety of factors such as faulty comp onents and inadequate design tolerances can result in errors app earing in the information b eing pro cessed by a computer. Such errors frequently o ccur in information transmission b etween two relatively distant p oints.
One of the simplest and most widely used techniques for error control is using a single parity bit C 0. This parity bit is app ended to an n bit input word X = (X 0 X 1 :::Xn 1 ) to form an (n + 1) bit word X = (X 0 X 1 :::Xn 1 C 0 ). The value assigned to bit C 0 makes the total numb er of bits in X even (if we are using even parity) or o dd (in the case of o dd parity). Thus, at the receiving end, an error can b e detected by taking an exclusive-or of all the bits received (X ).
Note that this simple technique of error control allows only detection of an error. It is not p ossible to determine the bit in error (or the p osition of the error). Hence, it is not p ossible to correct the error at the receiving end. This leads to retransmission of the information. In addition, this parity only provides single error detection (or in fact, an o dd numb er of errors can b e detected). It do es not detect multiple errors (even in numb er).
The parity-checking concept can b e easily extended to detection of multiple errors, or to the lo cation of single or multiple errors. These goals can b e achieved by providing additional parity bits, each of which check the parity of a subset of the bits in X . For example, if we can deduce (from the parity bits) that bit Xi is in error, then the error can b e corrected by simply complementing that bit, thus proving single error correction. Let c b e the numb er of parity bits required to achieve single error correction with n-bit data words. Clearly, the check bits must b e able to distinguish b etween (n + c) p ossible error lo cation and the single error-free case. Hence,
2 c^ n + c + 1
It can b e proved that this co de is Single Error Correcting Double Error Detecting (SECDED) co de. This is also known as Hamming Code.
The key question that remains to b e answered is: How to generate the value of c parity bits that are app ended to X = (x 0 x 1 :::xn 1 ) to obtain X ? Also, how to obtain the lo cation of error from X ? The pro cess is illustrated in the following example:
Let n = 4. Then, c = 3 (since, 23 4 + 3 + 1). Let M = (m 0 m 1 m 2 m 3 ) b e the message bits and let the three parity bits b e (p 0 p 1 p 2 ). Organize the bits as follows:
BIT m 0 m 1 m 2 p 0 m 3 p 1 p 2
Then, the check bits (p 0 p 1 p 2 ) can b e computed as follows:
p 2 = m 3 m 2 m 0 (1)
p 1 = m 3 m 1 m 0 (2)
p 0 = m 2 m 1 m 0 (3)
Note that one change in data bits pro duces at least two changes in check bits. Similarly, two changes in data bits pro duce at least one change in check bits. Hence, the minimum distance b etween two valid co de words is three. (Recall that the distance b etween two words is equal to the numb er of bits that need to b e ipp ed to obtain one numb er from other. For example, the distance b etween 0110 and 0101 is 2.) As a result, it is a single-error-correcting co de.
The p osition of the single error can b e detected using vector (c 0 c 1 c 2 ) derived as follows:
c 2 = p 2 m 3 m 2 m 0 (4)
c 1 = p 1 m 3 m 1 m 0 (5)
c 0 = p 0 m 2 m 1 m 0 (6)
Thus, if c 0 = c 1 = c 2 = 0, then there is no single error. The general technique to obtain these equation is describ ed as follows:
POSITION 7 6 5 4 3 2 1
POSITION 7 6 5 4 3 2 1 BIT m 0 m 1 m 2 p 0 m 3 p 1 p 2