Upload
iric911
View
220
Download
0
Embed Size (px)
Citation preview
8/11/2019 lec5-ErrorDetectionCorrection
1/29
Data Communication &Computer Networks
byDr. Nguyen Minh Hoang
[email protected] [email protected]
April 2013
mailto:[email protected]:[email protected]:[email protected]:[email protected]8/11/2019 lec5-ErrorDetectionCorrection
2/29
Data Link Layer
8/11/2019 lec5-ErrorDetectionCorrection
3/29
LLC and MAC Sublayers
8/11/2019 lec5-ErrorDetectionCorrection
4/29
Single Bit Error vs. Burst Error
8/11/2019 lec5-ErrorDetectionCorrection
5/29
Error Detection
Error detection uses the concept of redundancy,which means adding extra bits for detecting
errors at the destination.
8/11/2019 lec5-ErrorDetectionCorrection
6/29
Redundancy for Error Detection
8/11/2019 lec5-ErrorDetectionCorrection
7/29
Parity Check
8/11/2019 lec5-ErrorDetectionCorrection
8/29
2-d Parity Check
8/11/2019 lec5-ErrorDetectionCorrection
9/29
2-d Parity CheckBased on bit addition A redundancy of n bits can detect aburst error of length nIf length more than n, can detect witha high probabilitySome exceptions
Any example?
8/11/2019 lec5-ErrorDetectionCorrection
10/29
Cyclic Redundancy Check (CRC)
Based on modulo-2 divisionMost popular
8/11/2019 lec5-ErrorDetectionCorrection
11/29
Binary Division in CRC Generator
8/11/2019 lec5-ErrorDetectionCorrection
12/29
Binary Division in CRC Checker
8/11/2019 lec5-ErrorDetectionCorrection
13/29
Standard PolynomialsName Polynomial Application
CRC-8 x 8 + x 2 + x + 1 ATMheader
CRC-10 x 10 + x 9 + x 5 + x 4 +
x 2 + 1 ATM AAL
ITU-16 x 16 + x 12 + x 5 + 1 HDLC
ITU-32
x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 +
x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1
LANs
8/11/2019 lec5-ErrorDetectionCorrection
14/29
Rules to Select A PolynomialShould not divisible by xDetect all burst errors of length less than or equal todegree
Should be divisible by x+1Detect all burst errors affecting an odd number ofbits
E.g., x+1, x2+1
The CRC-12x12 + x11 + x3 + x + 1detect all burst errors affecting an odd number ofbits, will detect all burst errors with a length lessthan or equal to 12, and will detect with 99.97%
probability burst errors with a length of 12 or more.
8/11/2019 lec5-ErrorDetectionCorrection
15/29
Checksum
8/11/2019 lec5-ErrorDetectionCorrection
16/29
Checksum: SendingSuppose the following block of 16 bits is to be sent usinga checksum of 8 bits.
10101001 00111001 The numbers are added using ones complement
10101001
00111001 ------------
Sum 11100010
Checksum 00011101
The pattern sent is 10101001 00111001 00011101
8/11/2019 lec5-ErrorDetectionCorrection
17/29
Checksum: ReceivingNow suppose the receiver receives the pattern sent inprevious Example and there is no error.10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s, which,after complementing, is all 0s and shows that there is no error.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the pattern is OK.
8/11/2019 lec5-ErrorDetectionCorrection
18/29
Checksum: ErrorA burst error of length 5 that affects 4 bits.
10101 11 1 11 111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110 => Complement 00111001 !!!??
8/11/2019 lec5-ErrorDetectionCorrection
19/29
Error CorrectionRetransmission
Go back N retransmissionSelective retransmission
Forward Error CorrectionHamming Code
Burst Error Correction
8/11/2019 lec5-ErrorDetectionCorrection
20/29
Forward Error CorrectionPurpose: An FEC (n, m) encoder
Take m -bit original data as input
Add r=n-m check bits to the original data toproduce a n-bit codewordThe receiver can fix any error
8/11/2019 lec5-ErrorDetectionCorrection
21/29
Hamming DistanceCode: set of codewordsHamming distance between 2 codewords isthe number of bit positions where the 2codewords differ
HammingDist(10001001, 10110001) = 3Hamming distance of a code is the minimum Hamming distance between any twocodewords in the code
HammingDist({0000000000,0000011111,1111100000,1111111111}) = 5
8/11/2019 lec5-ErrorDetectionCorrection
22/29
Interesting FindingsTo detect d single-bit errors
Need a distance-( d+1 ) codeAppling d single-bit errors to a codeword must resultin an invalid codeword. ( WHY?)
To correct d single-bit errorsNeed a distance-( 2d+1) code
Given an incorrect codeword, the correspondingcorrect one must be the codeword closest in Hammingdistance ( WHY?)
8/11/2019 lec5-ErrorDetectionCorrection
23/29
How Many Extra Bits is Needed?Msg 1msg x x 1
1-x 1
x2 xm+r
x2 xm+r
x1 1-x 2 xm+r
x1 x2 1-x m+r
m+r+1invalid
Suppose we want to correct single errors# all possible data inputs = 2 m, # possible (m+r)-bit numbers = 2 m+r => 2m(m+r+1) 2m+r =>m+r+1 2 r
# check bits needed = r min
8/11/2019 lec5-ErrorDetectionCorrection
24/29
Data and Redundancy BitsNumber of data bits
mNumber of redundancy bits
rTotal bits
m + r
1 2 32 3 5
3 3 6
4 3 7
5 4 9
6 4 10
7 4 11
8/11/2019 lec5-ErrorDetectionCorrection
25/29
Hamming CodeTo correct single errorsRedundant bits are placed at all power-of-2 positions of the original data bits.
The value of a redundant bit is the parity check bitof a set of data bits.
Considering a data bit at position k , express k as a sum ofpowers of 2.
E.g., 11 = 1+2+8. Thus, data bit at position 11 is checked by
redundant bit at position 1, 2, and 8.
8/11/2019 lec5-ErrorDetectionCorrection
26/29
Redundant bits in Hamming Code
8/11/2019 lec5-ErrorDetectionCorrection
27/29
Correct Errors with HammingCode
Correct: 10011100101
Parity check for r1
Parity check for r2
Parity check for r4
Parity check for r8
8/11/2019 lec5-ErrorDetectionCorrection
28/29
Burst Errors with HammingCode
A sequence of k codewords is arranged as a matrix,1st column sent first, then 2 nd column, then 3 rd , etc.
k-bit burst error => at most 1 bit in each codeword is wrongUse Hamming code to correct such bits
8/11/2019 lec5-ErrorDetectionCorrection
29/29
Question?