Chapter 10 Error Detection and Correction• Types of Errors• Detection• Correction
Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected. Error detection and correction are implemented either at the data link layer or the transport layer of the OSI model.
Single bit errors are the least likely type of errors in serial data transmission because the noise must have a very short duration which is very rare. However this kind of errors can happen in parallel transmission.Example:If data is sent at 1Mbps then each bit lasts only 1/1,000,000 sec. or 1 μs.For a single-bit error to occur, the noise must have a duration of only 1 μs, which is very rare.
The term burst error means that two ormore bits in the data unit have changedfrom 1 to 0 or from 0 to 1.Burst errors does not necessarily mean thatthe errors occur in consecutive bits, thelength of the burst is measured from thefirst corrupted bit to the last corrupted bit.Some bits in between may not have beencorrupted.
Burst error is most likely to happen in serial transmission since the duration of noise is normally longer than the duration of a bit.The number of bits affected depends on the data rate and duration of noise.Example:If data is sent at rate = 1Kbps then a noise of 1/100 sec can affect 10 bits.(1/100*1000)If same data is sent at rate = 1Mbps then a noise of 1/100 sec can affect 10,000 bits.(1/100*106)
Error detectionError detection means to decide whether thereceived data is correct or not without having acopy of the original message.Error detection uses the concept ofredundancy, which means adding extra bits fordetecting errors at the destination.
Error detection/correction• Error detection – Check if any error has occurred – Don’t care the number of errors – Don’t care the positions of errors• Error correction – Need to know the number of errors – Need to know the positions of errors – More difficult10.11
Figure 10.3 The structure of encoder and decoder To detect or correct errors, we need to send extra (redundant) bits with data. 10.12
Modular Arithmetic• Modulus N: the upper limit• In modulo-N arithmetic, we use only the integers in the range 0 to N −1, inclusive.• If N is 2, we use only 0 and 1• No carry in the calculation (sum and subtraction)10.13
Figure 10.4 XORing of two single bits or two words 10.14
BLOCK CODING• Message is divided into blocks each of k bits called datawords.• Adding r redundant bits to each block to make the length• n=k+r ; n=codeword• Combination of datawords = 2^k• Combination of codewords =2^n where n>k• Block coding is one to one process
Structure of encoder and decoder in error correction 10.20
Table 10.2 A code for error correction (Example 10.3)10.21
Hamming Distance• The Hamming distance between two words is the number of differences between corresponding bits.• The minimum Hamming distance is the smallest Hamming distance between all possible pairs in a set of words.10.22
We can count the number of 1s in the Xoring of two words1. The Hamming distance d(000, 011) is 2 because2. The Hamming distance d(10101, 11110) is 3 because 10.23
Find the minimum Hamming distance of the coding schemeSolutionWe first find all Hamming distances.The dmin in this case is 2.10.24
Find the minimum Hamming distance of the coding schemeSolutionWe first find all the Hamming distances. The dmin in this case is 3. 10.25
Minimum Distance for Error Detection• To guarantee the detection of up to s errors in all cases, the minimum Hamming distance in a block code must be dmin = s + 1.10.26
Example 10.7•The minimum Hamming distance for our first codescheme (Table 10.1) is 2. This code guarantees detection ofonly a single error.•For example, if the third codeword (101) is sent and oneerror occurs, the received codeword does not match anyvalid codeword. If two errors occur, however, the receivedcodeword may match a valid codeword and the errors arenot detected. 10.27
Example 10.8•Table 10.2 has dmin = 3. This code can detect up to twoerrors. When any of the valid codewords is sent, two errorscreate a codeword which is not in the table of validcodewords. 10.28
Figure 10.8 Geometric concept for finding dmin in error detection 10.29
Figure 10.9 Geometric concept for finding dmin in error correction To guarantee correction of up to t errors in all cases, the minimum Hamming distance in a block code must be dmin = 2t + 1. 10.30
Example 10.9A code scheme has a Hamming distance dmin = 4. What isthe error detection and correction capability of thisscheme?SolutionThis code guarantees the detection of up to three errors(s = 3), but it can correct up to one error. In other words,if this code is used for error correction, part of itscapability is wasted. Error correction codes need tohave an odd minimum distance (3, 5, 7, . . . ). 10.31
10-3 LINEAR BLOCK CODES•Almost all block codes used today belong to asubset called linear block codes.•A linear block code is a code in which theexclusive OR (addition modulo-2 / XOR) of twovalid codewords creates another validcodeword. 10.32
Example 10.10Let us see if the two codes we defined in Table 10.1 andTable 10.2 belong to the class of linear block codes.1. The scheme in Table 10.1 is a linear block code because the result of XORing any codeword with any other codeword is a valid codeword. For example, the XORing of the second and third codewords creates the fourth one.2. The scheme in Table 10.2 is also a linear block code. We can create all four codewords by XORing two other codewords. 10.33
Minimum Distance for Linear Block Codes• The minimum hamming distance is the number of 1s in the nonzero valid codeword with the smallest number of 1s 10.34
Linear Block Codes• Simple parity-check code• Hamming codes10.35
Table 10.3 Simple parity-check code C(5, 4) •A simple parity-check code is a single-bit error-detecting code in which n = k + 1 with dmin = 2. •The extra bit (parity bit) is to make the total number of 1s in the codeword even •A simple parity-check code can detect an odd10.36 number of errors.
Figure 10.10 Encoder and decoder for simple parity-check code 10.37
Encoder uses a generator that takes 4 bit dataword(a0 a1 a2 a3)and generates a parity bit r0.So a 5 bit code is generated.Parity bit is added to make the number of 1s in the codewordeven. r0=a3+a2+a1+a0 (modulo-2)At the receiver, addition is done all over 5 bits.The result is called syndrome.It is one bit.Syndrome is 0→ number of 1s is evenSyndrome is 1→ number of 1s is odd S0=b3+b2+b1+b0+q0 (modulo-2)
Example 10.12Let us look at some transmission scenarios. Assume thesender sends the dataword 1011. The codeword createdfrom this dataword is 10111, which is sent to the receiver.We examine five cases:1. No error occurs; the received codeword is 10111. The syndrome is 0. The dataword 1011 is created.2. One single-bit error changes a1 . The received codeword is 10011. The syndrome is 1. No dataword is created.3. One single-bit error changes r0 . The received codeword is 10110. The syndrome is 1. No dataword is created. 10.39
Example 10.12 (continued)4. An error changes r0 and a second error changes a3 . The received codeword is 00110. The syndrome is 0. The dataword 0011 is created at the receiver. Note that here the dataword is wrongly created due to the syndrome value.5. Three bits—a3, a2, and a1—are changed by errors. The received codeword is 01011. The syndrome is 1. The dataword is not created. This shows that the simple parity check, guaranteed to detect one single error, can also find any odd number of errors. 10.40
10-4 CYCLIC CODESCyclic codes are special linear block codes with oneextra property. In a cyclic code, if a codeword iscyclically shifted (rotated), the result is anothercodeword. For eg- if 1011000 is a codeword and if it is left shifted then 0110001 is also a codeword. 10.44
In the encoder, the dataword has k bits.Codeword has n bits.Size of dataword is augmented by adding n-k 0s to the righthand side of the word.Size of divisor is n-k+1; predefined and agreed upon.Generator divides the augmented dataword by thedivisor(modulo-2 division).Quotient is discarded and the remainder(r2r1r0) is appendedto the dataword to create the codeword.Decoder receives the codeword and a copy of all n bits is fedto the checker which is a replica of the generator.The remainder produced by the checker is a syndrome of n-kbits which is fed to decision logic analyzer.Syndrome bits→all 0s (no error) else discarded.
POLYNOMIALSA pattern of 0 and 1 can be represented as a polynomialwith coefficients of 0 and 1.The power of each term shows position of the bit.Coefficient shows the value of the bit.Degree of polynomial is highest power in it.NOTE-Degree is one less than the number of bits in thepattern.
Figure 10.21 A polynomial to represent a binary word 10.49
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.