Error Detection - Correction

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 31

Error Detection

and
Correction
Data Link Layer
Data Link Layer
Data can be corrupted
during transmission.

Some applications require that


errors to be detected and corrected.

Ex:- 1. Audio or video ,small errors my be acceptable.

2. For text accuracy is required.


INTRODUCTION

Some of the issues related (directly or indirectly) to


error detection and correction.

1. Types of Errors
2. Redundancy
3. Détection Versus Correction
4. Forward Error Correction Versus Retransmission
1. Types of Errors

1. Single bit error

2. Burst error
Figure Single-bit error

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


unit has changed. It is generally
occurred in serial transmission.
Figure Burst error

A burst error means that 2 or more bits


in the data unit have changed.

The length of the burst is measured from the first


corrupted bit to the last corrupted bit.
Noise generally not effected on a single bit. it
effects more than one bit. These errors will be
occurred due to the duration of the noise is greater
than the duration of the bit . So. It depends on the
duration of the noise and the data transfer rate.

1. Sending the data at a rate of 1Kbps, a noise of


1/100s and it can effect 10 bits.

2. Sending the data at a rate of 1Mbps, a noise of


1/100s and it can effect 10,000 bits.
2. Redundancy

To detect or correct errors, we need to


send extra (redundant) bits with data.

These redundant bits of data must be


added by the sender and removed by the
receiver. It helps the receiver to detect or
correct the errors.
3. Detection Versus Correction
In error detection, we will find the error
is occurred or not and it is easy to find .

Error correction is difficult , i.e we have to know


the number of bits corrupted and position of the error
bits in the message.
If we need to correct one single error in an 8 bit, 8
possible error locations.
If we need two errors in the same size, the
number of possible errors locations are 28. For 10
errors in a 1000bits, difficult to find.
4. Forward Error Correction Versus Retransmission

Two methods of error corrections


1. Forward error correction
2. Retransmission.
In forward error correction, receiver tries to
guess the message by using redundant bits. This is
used if the number of errors are small.
In Retransmission, the receiver detects of an
error and ask the sender to resend the message.
Resending is repeated until a message arrives that the
receiver believes is error free.
5. Coding

 Process of adding redundancy for error detection


or correction is called coding.

 Two types:
 Block coding
 Convolutional coding
 Treats data as a series of bits, and computes a code over a
continuous series
 The code computed for a set of bits depends on the current
and previous input

Generally we use only block codes


Figure coding: The structure of encoder and decoder

Redundancy is achieved through various coding schemes. The


sender adds redundant bits through a process that creates relationship
between the redundant bits and the actual bits. The receiver checks the
relationship between the two sets of bits to detect or correct the errors.
BLOCK CODING

In block coding, we divide our


message into blocks, each of k bits, called datawords.
We add r redundant bits to each block to make the
length n = k + r. The resulting n-bit blocks are called
codewords.
Figure Data words and code words in block coding
BLOCK CODING

The block coding process is one to one , the same


dataword is always encoded as the same codeword. This means
that, we have 2n – 2k codewords that are not used. These code
words are invalid or illegal.

The 4B/5B block coding is a good example of this type


of coding. In this coding scheme, k = 4 and n = 5. Then , we
have 2k = 16 datawords and 2n = 32 codewords. So 16 out of 32
codewords are used for message transfer and the rest are either
used for other purposes or unused.
BLOCK CODING

The main topics includes:


Error Detection
Error Correction
Hamming Distance
Minimum Hamming Distance
Error Detection
 How errors are detected by using block coding ?
 They are two conditions ,the receiver can detect a change
 The receiver has a list of valid codewords.
 The original codeword has changed to an invalid one.
Example 1
Let us assume that k = 2 and n = 3. Table 1 shows the list of datawords and
codewords. Assume the sender encodes the dataword 01 as 011 and sends it
to the receiver. Consider the following cases:
1.The receiver receives 011. It is a valid codeword.The receiver extracts the
dataword 01 from it.
2. The codeword is corrupted during transmission, and
111 is received. This is not a valid codeword and is
discarded.
3.The codeword is corrupted during transmission, and 000 is received. This
is a valid codeword. The receiver incorrectly extracts the dataword 00. The
corrupted bits have made the error undetectable.
Table 1 A code for error detection (Example 1)
An error-detecting code can detect
only the types of errors for which it is
designed; other types of errors may
remain undetected.
Error Correction

 In error detection, the receiver needs to know


only that the received codeword is invalid or
valid.
 But in error correction the receiver needs to
find or guess the original codeword sent.
 So we need more number of redundant bits for
error correction than error detection. And hence
we need complex checker function at the
receiver.
Figure Structure of encoder and decoder in error correction
Example 2
Assume the dataword is 01. The sender
creates the codeword 01011. The codeword is corrupted
during transmission, and 01001 is received.

First, the receiver finds that the received codeword is


not in the table. This means an error has occurred. The
receiver, assuming that there is only 1 bit corrupted, uses
the following strategy to guess the correct dataword.
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.
Table 2 A code for error correction (Example 2)
Hamming Distance

It is used in the coding for error control.


The Hamming distance between two words (of the same size) is the
number of differences between the corresponding bits.
Hamming distance between two words x and y is d(x,y)
It can be computed by applying the XOR operation on the two
words and count the number of 1s in the result
Hamming distance is a value greater than zero

The Hamming distance between two


words is the number of differences
between corresponding bits.
Example 3

Let us find the Hamming distance between two


pairs of words.

1. The Hamming distance d(000, 011) is 2 because

2. The Hamming distance d(10101, 11110) is 3


because
Note

The minimum Hamming distance is the


smallest Hamming distance between
all possible pairs in a set of words.
Example 4

Find the minimum Hamming distance of the coding


scheme for the following table

Solution
We first find all Hamming distances.

The dmin in this case is 2.

You might also like