Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

Chapter 10

Lecture 7
Error Detection
and
Correction

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10.1
10-1 INTRODUCTION

Topics discussed in this section:


Types of Errors
Redundancy
Parity Check
Cyclic Redundancy Check (CRC)

10.2
Data link layer duties
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.
Types of Errors
Note

In a single-bit error, only 1 bit in the data


unit has changed.

10.6
Single-bit Error

In a single-bit error, only 1 bit in the data


unit has changed.

Single-bit error
Burst Error
▪ The term burst error means that two or more bits in the data
unit have changed from 1 to 0 or from 0 to 1.
▪ Burst errors does not necessarily mean that the errors
occur in consecutive bits,
▪ the length of the burst is measured from the first corrupted bit
to the last corrupted bit.
▪ Some bits in between may not have been corrupted.

Figure 10.2 Burst error of length 8


Figure 10.2 Burst error of length 5

10.9
Error Detection

▪ Error detection means to decide whether the


received data is correct or not without having a
copy of the original message.
▪ Error detection uses the concept of redundancy,
which means adding extra bits for detecting
errors at the destination.
Redundancy:The structure of encoder and decoder

To detect or correct errors, we need to send extra


(redundant) bits with data.

10.11
Redundancy

10.12
Detection Methods
Parity Check
▪ The simplest error-detecting scheme is to append a parity bit
to the end of a block of data.
▪ A parity bit is added to every data unit so that the total number
of 1s (including the parity bit) becomes even for even-parity
check or odd for odd-parity check
▪ A typical example is character transmission, in which a parity
bit is attached to each 7-bit ASCII character
Table 10.3 Simple even parity-check code C(5, 4)

10.15
Parity Check – Example 1
Suppose the sender wants to send the word world. In ASCII
the five characters are coded as
w → (1110111) o → (1101111) r →(1110010)
l →(1101100) d(1100100)
What will be the transmitter code using even parity?

Solution:
The following shows the actual bits for the code-words sent
11101110 11011110 11100100 11011000 11001001
Example 2

Now suppose the word world in Example 1 is received by


the receiver and you know you are using an even parity.
11101110 11011110 11100100 11011000 11001001
Is the received binary bits error?

Solution:
The receiver counts the 1s in each character and comes up
with even numbers (6, 6, 4, 4, 4). The data is accepted.
Example 3

Now suppose the following binary bits for the word world in
Example 1 are received by the receiver and the receiver
knows that the even parity check is used.
11111110 11011110 11101100 11011000 11001001
is the received binary bits error?

Solution:
The receiver counts the 1s in each character and comes up
with even and odd numbers (7, 6, 5, 4, 4).
The receiver knows that the data are corrupted, discards them,
and asks for retransmission.
Example 4
Let us look at some transmission scenarios. Assume the
sender sends the dataword 1011. The codeword created
from this dataword is 10111, which is sent to the receiver.
We examine five cases:

1. No error occurs; the received codeword is 10111. The


number of 1s is even (4). The dataword 1011 is created.
2. One single-bit error changes a1 . The received
codeword is 10011. The number of 1s is odd (3). No
dataword is created.
3. One single-bit error changes parity bit . The received
codeword is 10110. The number of 1s is odd (3). No
dataword is created.
Example 4 (cont.)

4. An error changes parity bit and a second error changes a3 .


The received codeword is 00110. The number of 1s is even
(2). 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 number of 1s is odd
(3).
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.
Note

A simple parity-check code is a


single-bit error-detecting
code

10.21
Cyclic Redundancy Check (CRC)
▪ One of the most common, and one of the most powerful, error-
detecting codes is the cyclic redundancy check (CRC), which can be
described as follows:
▪ Given a k-bit block of bits, or message, the transmitter generates an
sequence, known as a frame check sequence (FCS) of n bits, such that
the resulting frame, consisting of (k+n) bits, is exactly divisible by
some predetermined number.
▪ The receiver then divides the incoming frame by the same number and,
if there is no remainder, assumes that there was no error.

FCS

FCS
CRC – Sender Operation
▪ M = original data message ( k bits)
▪ G = Predefined and agreed upon divisor pattern (n+1 bits)
▪ Mn = M concatenated with n zeros
▪ R = remainder of dividing ( Mn / G )
▪ R is also called FCS
M

MR Mn
G
FCS
R
FCS
CRC encoder and decoder
▪ Sender Operation
▪ The transmitter performs the division Mn / G
▪ The transmitter then computes the remainder R
▪ It then concatenates the remainder with the message “MR”
▪ Then it sends the encoded message over the channel “MR”.

M
Mn

R
MR

10.24
CRC Encoder and Decoder
▪ Receiver Operation:
▪ The receiver receives the message MR
▪ It then performs the division of the message by the predetermined
pattern G, “ MR / G ”
▪ If the remainder is zero, then it assumes the message is not
corrupted “Does not have any error”. Although it may have some.
▪ If the remainder is NON-zero, then for sure the message is corrupted
and contain error/s.

M
Mn

MR

10.25
CRC - Division Process
▪ The division used in the CRC is a modulo-2 arithmetic
division.
▪ Exactly like ordinary long division, only simpler, because at
each stage we just need to check whether the leading bit
(leftmost bit) of the current dividend is 0 or 1.
▪ If it's 0, we place a 0 in the quotient and exclusively OR the current
dividend bits with zeros.
▪ If it's 1, we place a 1 in the quotient and exclusively OR the dividend
current bits with the divisor.
Figure 10.4 XORing of two single bits or two words

10.27
CRC – Example 1
Using CRC for error detection and given a message M = 100100 with G =
1100, compute the following
a) Frame check Sum (FCS)
b) Transmitted frame

Received frame and check if


there is any error in
the data

b) Transmitted frame
FCS
100100001
CRC – Example 2
Using CRC for error detection and given a message M = 1001 with
G = 1011, compute the following
a) Frame check Sum (FCS)
b) Transmitted frame
c) Check if there is any error in the data if the received frame
1001110 and 1000110.

(FCS)

b) Transmitted frame
CRC – Example 2 (cont.)

10.30
CRC – Exercises

Exercise 1
Using CRC for error detection and given a message
M = 10110 with G = 110, compute the following
a) Frame check Sum (FCS)
b) Transmitted frame
c) Received frame and check if there is any error in the data

Exercise 2
Using CRC for error detection and given a message
M = 111001 with G = 11001, compute the following
a) Frame check Sum (FCS)
b) Transmitted frame
c) Received frame and check if there is any error in the data

10.31
Polynomial
Polynomial and Divisor
Figure 10.21 A polynomial to represent a binary word

10.34
Figure 10.22 CRC division using polynomials

M = 1001000 → x + x 6 3
G = 1011 → x + x + 1
3

Mn = 1001000 → x 6 + x 3

10.35
Standard Polynomials

a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0


1x12 + 1x11 + 0 x10 + 0 x 9 + 0 x 8 + 0 x 7 + 0 x 6 + 0 x 5 + 0 x 4 + 1x 3 + 0 x 2 + 1x + 1
G = 1100000001 011
Table 10.7 Standard polynomials

10.37
End of Lecture 7

10.38
Vertical Redundancy Check (VRC)
Longitudinal Redundancy Check (LRC)
Two-dimensional parity-check code

Two –Dimensional Parity Check


10.42
Figure 10.11 Two-dimensional parity-check code
10.43
Figure 10.11 Two-dimensional parity-check code
10.44
Figure 10.11 Two-dimensional parity-check code

You might also like