0% found this document useful (0 votes)
23 views

Module-2 Chapter-10

Uploaded by

karthikwagle321
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Module-2 Chapter-10

Uploaded by

karthikwagle321
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

MODULE-2:DATA LINK LAYER

Chapter 10
Error Detection and Correction

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000


10-1 INTRODUCTION

• Data can be corrupted during transmission.


• Some applications require that errors be detected and
corrected.
Types of Errors
• Whenever bits flow from one point to another, they are
subject to unpredictable changes because of interference.
1. single-bit error
2. burst error
Figure 10.1 Single-bit error
Figure 10.2 Burst error of length 8
Redundancy

• The central concept in detecting or correcting errors is


redundancy.
• detect or correct errors, we need to send some extra bits
with our data.

• These redundant bits are added by the sender and removed


by the receiver.
Detection versus Correction

• The correction of errors is more difficult than the detection.


• In error detection, we are only looking to see if any error
has occurred.
• In error correction, we need to know the exact number of
bits that are corrupted and, more importantly, their location
in the message.
Coding

• Redundancy is achieved through various coding


schemes.
• broad categories of coding scheme:
• block coding
• convolution coding.
10-2 BLOCK CODING

• In block coding, message is divided into blocks, each


of k bits, called datawords.
• add r redundant bits to each block to make the length
n = k + r.
• The resulting n-bit blocks are called codewords.
Error Detection

• the receiver can detect a change in the original codeword


based on 2 conditions.

1. The receiver has (or can find) a list of valid codewords.


2. The original codeword has changed to an invalid one.
Figure 10.3 The structure of encoder and decoder

To detect or correct errors, we need to send redundant bits


At Sender
• The sender creates code-words out of data-words by using
a generator
• The generator applies the rules and procedures of encoding.
• During transmission, each code-word sent to the receiver
may change.
At Receiver
• If the received code-word is the same as one of the valid
code-words, the code-word is accepted
• the corresponding data-word is extracted for use.

• If the received code-word is invalid, the code-word is


discarded.

• if the code-word is corrupted but the received code-word


still matches a valid code- word, the error remains
undetected
• An error-detecting code can detect only the types of errors
for which it is designed; other types of errors may remain
undetected.
Table 10.1 A code for error detection (k=2 and n=3)

What if we want to send 01? We code it as 011.

• If 011 is received, no problem.


• What if 001 is received? Error detected.
• What if 000 is received? Error occurred, but not detected.
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 (the leftmost bit is corrupted).
• This is not a valid codeword and is discarded.
3. The codeword is corrupted during transmission, and 000 is
received (the right two bits are corrupted).
• This is a valid codeword.
• The receiver incorrectly extracts the dataword 00.
4. Two corrupted bits have made the error undetectable.
Hamming Distance

• One of the central concepts in coding for error


control is the idea of the Hamming distance.

• The Hamming distance between two words (of the


same size) is the number of differences between the
corresponding bits.

• if the Hamming distance between the sent and the


received codeword is not zero, the codeword has
been corrupted during transmission.
Hamming Distance

• Let us find the Hamming distance between two pairs of


words.
• 1. The Hamming distance d(000, 011) is 2 because (000
⊕ 011) is 011 (two 1s).
• 2. The Hamming distance d(10101, 11110) is 3 because
(10101 ⊕ 11110) is 01011 (three 1s).
LINEAR BLOCK CODES

• Almost all block codes used today belong to a subset


called linear block codes.
• A linear block code is a code in which the exclusive OR
(addition modulo-2) of two valid codewords creates
another valid codeword
Parity-Check Code

• the most familiar error-detecting code is the parity-


check code.
• This code is a linear block code.
• In this code, a k-bit dataword is changed to an n-bit
codeword where n = k + 1.
• The extra bit, called the parity bit, is selected to make
the total number of 1s in the codeword even.
Table 10.3 Simple parity-check code C(5, 4)
Figure 10.10 Encoder and decoder for simple parity-check code
Parity-Check Code
• The calculation is done in modular arithmetic.
• The encoder uses a generator that takes a copy of a 4-bit dataword
(a0, a1, a2, and a3) and generates a parity bit r0.
• The dataword bits and the parity bit create the 5-bit codeword.
• The parity bit that is added makes the number of 1s in the
codeword even.
• This is normally done by adding the 4 bits of the dataword
(modulo-2);
• the result is the parity bit
• If the number of 1s is even, the result is 0
• if the number of 1s is odd, the result is 1.

• In both cases, the total number of 1s in the codeword is even.


Parity-Check Code- example
• Assume the sender sends the dataword 1011. The codeword
created from this dataword is 10111, which is sent to the receiver.
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. Note that although none
of the dataword bits are corrupted, no dataword is created because
the code is not sophisticated enough to show the position of the
corrupted bit.
Parity-Check Code- example
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.
CYCLIC CODES

• Cyclic codes are special linear block codes with one


extra property.
• In a cyclic code, if a codeword is cyclically shifted
(rotated), the result is another codeword.
• Cyclic Redundancy Check
Cyclic Redundancy Check
• subset of cyclic codes called the cyclic redundancy check
(CRC),
• which is used in networks such as LANs and WANs.
Cyclic Redundancy Check
Encoder:
• the dataword has k bits (4 here); the codeword has n bits (7 here).
• The size of the dataword is augmented by adding n − k (3 here) 0s
to the right-hand side of the word.
• The n-bit result is fed into the generator. The generator uses a
divisor of size n − k + 1 (4 here)(predefined and agreed upon)
• The generator divides the augmented dataword by the divisor
• The quotient of the division is discarded;
• the remainder (r2,r1,r0) is appended to the dataword to create the
codeword.
Decoder
• receives the codeword .
• A copy of all n bits is fed to the checker, which is a replica
of the generator.
• The remainder produced by the checker is a syndrome of n −
k (3 here) bits, which is fed to the decision logic analyzer.
• The analyzer has a simple function. If the syndrome bits are
all 0s, the 4 leftmost bits of the codeword are accepted as the
dataword
• otherwise, the 4 bits are discarded (error).
Polynomials
• A better way to understand cyclic codes and how they can be
analyzed is to represent them as polynomials.
• A pattern of 0s and 1s can be represented as a polynomial with
coefficients of 0 and 1.
• The power of each term shows the position of the bit; the
coefficient shows the value of the bit.
Polynomials
• Degree of a Polynomial.
• Adding and Subtracting Polynomials
• Multiplying Two Polynomials
• Dividing One Polynomial by Another
Polynomials
Advantages of Cyclic Codes

• very good performance in detecting single-bit errors, double


errors, an odd number of errors, and burst errors.
• easily be implemented in hardware and software.
• fast when implemented in hardware.
Hardware Implementation
1. We assume that the remainder is originally all 0s
2. At each time click (arrival of 1 bit from an augmented
dataword), we repeat the following two actions:
a. We use the leftmost bit to make a decision about the
divisor (011 or 000).
b. The other 2 bits of the remainder and the next bit from
the augmented dataword (total of 3 bits) are XORed with
the 3-bit divisor to create the next remainder.
CHECKSUM
• Checksum is an error-detecting technique that can be
applied to a message of any length.
• At the source, the message is first divided into m-bit units.
• The generator then creates an extra m-bit unit called the
checksum, which is sent with the message.
• At the destination, the checker creates a new checksum from
the combination of the message and sent checksum.
• If the new checksum is all 0s, the message is accepted;
otherwise, the message is discarded
INTERNET CHECKSUM
Other Approaches to the Checksum

1.Fletcher
2. Adler.
Fletcher Checksum
• The Fletcher checksum was devised to weight each data item
according to its position.
• Fletcher has proposed two algorithms
• 8-bit
• 16-bit.
• The first, 8-bit Fletcher, calculates on 8-bit data items and creates
a 16-bit checksum.
• The second, 16-bit Fletcher, calculates on 16-bit data items and
creates a 32-bit checksum.
Fletcher Checksum
Adler Checksum
• The Adler checksum is a 32-bit checksum.
FORWARD ERROR CORRECTION (FEC)
• Using Hamming Distance
• Using XOR
• Chunk Interleaving
• Compounding High- and Low-Resolution Packets
• Combining Hamming Distance and Interleaving

You might also like