CH 10
CH 10
Error Detection
and
Correction
10.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Networks must be able to transfer data from one device to another
with acceptable accuracy.
• Some applications can tolerate a small level of error. For example,
random errors in audio or video transmissions may be tolerable,
but when we transfer text, we expect a very high level of accuracy.
• Error control in the data link layer is based on automatic repeat
request (ARQ), which is the retransmission of data.
• Error control is both error detection and error correction.
10.2
10-1 INTRODUCTION
10.3
Note
10.4
Note
10.5
Note
10.6
10-2 BLOCK CODING
since n > k
10.8
Example 10.2
An error-detecting code can detect only the types of
errors for which it is designed; other types of errors
may remain undetected.
10.9
Example 10.2 (continued)
10.11
Example 10.3
10.12
Example 10.3 (continued)
1. Comparing the received codeword with the first codeword in the table (01001
versus 00000), the receiver decides that the first codeword is not the one that
was sent because there are two different bits.
2. By the same reasoning, the original codeword cannot be the third or fourth
one in the table.
3. The original codeword must be the second one in the table because this is the
only one that differs from the received codeword by 1 bit. The receiver
replaces 01001 with 01011 and consults the table to find the dataword 01.
10.14
Example 10.4
10.15
Note
10.16
Example 10.5
10.17
Example 10.6
Solution
We first find all the Hamming distances.
10.18
Note
10.19
10-3 LINEAR BLOCK CODES
10.20
Note
10.21
Figure 10.10 Encoder and decoder for simple parity-check code
• The encoder uses a generator that takes a copy of a 4-bit dataword and generates
a parity bit.
• If the number of 1s is even, the parity result is 0; if the number of 1s is odd, the
result is 1. The dataword bits and the parity bit create the 5-bit codeword.
• In both cases, the total number of 1s in the codeword is even.
10.22
The checker at the receiver does the same thing as the generator in the sender
with one exception: The addition is done over all 5 bits.
The result, which is called the syndrome, is just 1 bit.
The syndrome is 0 when the number of 1s in the received codeword is even;
otherwise, it is 1. If the syndrome is 0, there is no error in the received
codeword.
Table 10.3 Simple parity-check code C(5, 4)
10.23
Example 10.12
10.26
Figure 10.12 The structure of the encoder and decoder for a Hamming code
A copy of a 4-bit dataword is fed into the generator that creates three parity
checks r0, r1 and r2. Each parity-check bits handles 3 out of the 4 bits of the dataword.
The checker in the decoder creates a 3-bit syndrome (S0, S1, S2) in which each bit is
the parity check for 4 out of the 7 bits in the received codeword.
r 0 = a 2 + a 1 + a 0 , r 1 = a 3 + a 2 + a1 , r 2 = a 3 + a 1 + a 0
S0 = b2 + b1 + b0 +q0 , S1 = b3 + b2 + b1 +q1 , S2 = b3 + b1 + b0 +q2
10.27
Table 10.4 Hamming code C(7, 4)
10.28
Table 10.5 Logical decision made by the correction logic analyzer
• The syndrome values in Table 10.5 are based on the syndrome bit
calculations. For example, if qo is in error, So is the only bit affected; the
syndrome, therefore, is 001.
• If b2 is in error, so and s1 are the bits affected; the syndrome, therefore is
011. Similarly, if b1`is in error, all 3 syndrome bits are affected, and the
syndrome is 111.
10.29
Example 10.14
10.30
10-4 CYCLIC CODES
10.31
Table 10.6 A CRC code with C(7, 4)
10.32
Figure 10.14 CRC encoder and decoder
10.33
Figure 10.15 Division in CRC encoder
10.34
Figure 10.16 Division in the CRC decoder for two cases
10.35
Figure 10.21 A polynomial to represent a binary word
10.36
Figure 10.22 CRC division using polynomials
10.37
10-5 CHECKSUM
10.38
Example 10.18
10.39
Example 10.19
10.40
Example 10.20
Solution
The number 21 in binary is 10101 (it needs five bits). We
can wrap the leftmost bit and add it to the four rightmost
bits. We have (0101 + 1) = 0110 or 6.
10.41
Example 10.21
Solution
In one’s complement arithmetic, the negative or
complement of a number is found by inverting all bits.
Positive 6 is 0110; negative 6 is 1001. If we consider only
unsigned numbers, this is 9. In other words, the
complement of 6 is 9. Another way to find the
complement of a number in one’s complement arithmetic
is to subtract the number from 2n − 1 (16 − 1 in this case).
10.42
Example 10.22
10.44
Figure 10.24 Example 10.22
10.45
Note
Sender side:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to 0.
3. All words including the checksum are
added using one’s complement addition.
4. The sum is complemented and becomes the
checksum.
5. The checksum is sent with the data.
10.46
Note
Receiver side:
1. The message (including checksum) is
divided into 16-bit words.
2. All words are added using one’s
complement addition.
3. The sum is complemented and becomes the
new checksum.
4. If the value of checksum is 0, the message
is accepted; otherwise, it is rejected.
10.47
FLOW AND ERROR CONTROL
11.48
Note
11.49
Note
11.50
Error Free Transmission
• Data link layer can combine framing, flow control, and error control
to achieve the delivery of data from one node to another.
• Flow control refers to a set of procedures used to restrict the amount
of data that the sender can send before waiting for acknowledgment.
• Uses buffer mechanism at receiver
• Retransmission using ARQ for lost or corrupted frames.
No flow/error control
10.51
• In Stop-and-Wait ARQ, we keep a copy of the
sent (one) frame and retransmit the frame when the
timer expires (Error correction).
• Use sequence numbers to number the frames
• In Go-Back-N, we can send several frames
before receiving acknowledgments; we keep a copy
of these frames until the acknowledgments arrive.
• If frame N has not been acknowledged; the sender goes
back and sends frames N onward again.
• Only the damaged frame is resent. This mechanism
is called Selective Repeat ARQ. It is more efficient
for noisy links, but the processing at the receiver is
more complex.
10.52