Sie sind auf Seite 1von 29

Data Communication &

Computer Networks
by
Dr. Nguyen Minh Hoang
hoangnm@ieee.org
hoangnm@hcmut.edu.vn
April 2013
Data Link Layer
LLC and MAC Sublayers
Single Bit Error vs. Burst Error
Error Detection
Error detection uses the concept of redundancy,
which means adding extra bits for detecting
errors at the destination.
Redundancy for Error Detection
Parity Check
2-d Parity Check
2-d Parity Check
Based on bit addition
A redundancy of n bits can detect a
burst error of length n
If length more than n, can detect with
a high probability
Some exceptions
Any example?
Cyclic Redundancy Check (CRC)
Based on modulo-2 division
Most popular
Binary Division in CRC Generator
Binary Division in CRC Checker
Standard Polynomials
Name Polynomial
Applic
ation
CRC-8 x
8
+ x
2
+ x + 1
ATM
header
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
Rules to Select A Polynomial
Should not divisible by x
Detect all burst errors of length less than or equal to
degree
Should be divisible by x+1
Detect all burst errors affecting an odd number of
bits
E.g., x+1, x
2
+1
The CRC-12
x12 + x11 + x3 + x + 1
detect all burst errors affecting an odd number of
bits, will detect all burst errors with a length less
than or equal to 12, and will detect with 99.97%
probability burst errors with a length of 12 or more.
Checksum
Checksum: Sending
Suppose the following block of 16 bits is to be sent using
a 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
Checksum: Receiving
Now suppose the receiver receives the pattern sent in
previous 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.
Checksum: Error
A burst error of length 5 that affects 4 bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110 => Complement 00111001 !!!??
Error Correction
Retransmission
Go back N retransmission
Selective retransmission
Forward Error Correction
Hamming Code
Burst Error Correction
Forward Error Correction
Purpose: An FEC (n, m) encoder
Take m-bit original data as input
Add r=n-m check bits to the original data to
produce a n-bit codeword
The receiver can fix any error
Hamming Distance
Code: set of codewords
Hamming distance between 2 codewords is
the number of bit positions where the 2
codewords differ
HammingDist(10001001, 10110001) = 3
Hamming distance of a code is the minimum
Hamming distance between any two
codewords in the code
HammingDist({0000000000,0000011111,1111100
000,1111111111}) = 5
Interesting Findings
To detect d single-bit errors
Need a distance-(d+1) code
Appling d single-bit errors to a codeword must result
in an invalid codeword. (WHY?)
To correct d single-bit errors
Need a distance-(2d+1) code
Given an incorrect codeword, the corresponding
correct one must be the codeword closest in Hamming
distance (WHY?)

How Many Extra Bits is Needed?
Msg 1 msg x x
1
1-x
1
x
2
x
m+r

x
2
x
m+r

x
1
1-x
2
x
m+r
x
1
x
2
1-x
m+r
m+r+1
invalid
Suppose we want to correct single errors
# all possible data inputs = 2
m
,

# possible (m+r)-bit numbers = 2
m+r

=> 2
m
(m+r+1) 2
m+r
=> m+r+1 2
r
# check bits needed = r
min
Data and Redundancy Bits
Number of data bits
m
Number of redundancy bits
r
Total bits
m + r
1
2 3
2
3 5
3
3 6
4
3 7
5
4 9
6
4 10
7
4 11
Hamming Code
To correct single errors
Redundant bits are placed at all power-of-2 positions
of the original data bits.
The value of a redundant bit is the parity check bit
of a set of data bits.
Considering a data bit at position k, express k as a sum of
powers 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.
Redundant bits in Hamming Code
Correct Errors with Hamming
Code
Correct: 10011100101
Parity check for r1
Parity check for r2
Parity check for r4
Parity check for r8
Burst Errors with Hamming
Code
A sequence of k codewords is arranged as a matrix,
1
st
column sent first, then 2
nd
column, then 3
rd
, etc.
k-bit burst error => at most 1 bit in each codeword is wrong
Use Hamming code to correct such bits
Question?

Das könnte Ihnen auch gefallen