Date post: | 13-Jan-2016 |
Category: |
Documents |
Upload: | jason-atkins |
View: | 227 times |
Download: | 0 times |
CSC 535 Communication Networks I
Section 3.8Error Detection and Correction
Dr. Cheer-Sun Yang
2
Data Link Layer FunctionsFramingError detection and correction Flow controlError recovery (frame level)
3
Error DetectionAdditional bits added by transmitter for
error detection codeParity
Value of parity bit is such that character has even (even parity) or odd (odd parity) number of ones
Even number of bit errors goes undetected
4
Cyclic Redundancy CheckFor a block of k bits transmitter generates
n bit sequenceTransmit k+n bits which is exactly
divisible by some numberReceive divides frame by that number
If no remainder, assume no error For math, see Stallings chapter 7
5
Error ControlForward Error Correction (FEC): Detection
and correction of errors FEC is appropriate when a return channel is not
available, retransmission requests are not easily accommodated, or retransmission is not efficient.
Automatic repeat request (ARQ) Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
6
Error Control TechniquesParity checking - a single bit error
detectionInternet checksumpolynomial codes (cyclic redundency
checking) - single bit error correction and multiple bit error detection
7
Automatic Repeat Request (ARQ)Stop-and-wait ARQGo-Back-N ARQSelective Repeat ARQ ( also known as
selective reject or selective retransmission)
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
8
ChannelEncoderUserinformation
PatternChecking
All inputs to channel satisfy pattern/condition
Channeloutput Deliver user
informationor
set error alarm
Figure 3.49
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
9
Calculate check bits
Channel
Recalculate check bits
Compare
Information bits Received information bits
Check bits
Information accepted if check bits match
Received check bits
Figure 350
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
10
x = codewords o = non-codewords
x
x x
x
x
x
x
o
oo
oo
oo
o
oo
o
oxx x
x
xx
x
o oo
oo
ooooo
o
o
A code with poor distance properties A code with good distance properties(a) (b)
Figure 3.51
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
11
1 0 0 1 0 0
0 1 0 0 0 1
1 0 0 1 0 0
1 1 0 1 1 0
1 0 0 1 1 1
Bottom row consists of check bit for each column
Last column consists of check bits for each row
Figure 3.52
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
12
1 0 0 1 0 0
0 0 0 0 0 1
1 0 0 1 0 0
1 1 0 1 1 0
1 0 0 1 1 1
1 0 0 1 0 0
0 0 0 0 0 1
1 0 0 1 0 0
1 0 0 1 1 0
1 0 0 1 1 1
1 0 0 1 0 0
0 0 0 1 0 1
1 0 0 1 0 0
1 0 0 1 1 0
1 0 0 1 1 1
1 0 0 1 0 0
0 0 0 1 0 1
1 0 0 1 0 0
1 0 0 0 1 0
1 0 0 1 1 1
Two errors
One error
Three errors
Four errors
Arrows indicate failed check bits
Figure 3.53
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
13
unsigned short cksum(unsigned short *addr, int count){
/*Compute Internet Checksum for “count” bytes * beginning at location “addr”.*/
register long sum = 0;while ( count > 1 ) {
/* This is the inner loop*/ sum += *addr++; count -=2;}
/* Add left-over byte, if any */if ( count > 0 )
sum += *addr;
/* Fold 32-bit sum to 16 bits */while (sum >>16)
sum = (sum & 0xffff) + (sum >> 16) ;
return ~sum;}
Figure 3.54
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
14
(x7 x6 1) (x6 x5 ) x7 (1 1)x6 x 5 1
x7 x5 1
(x 1)(x2 x 1) x3 x 2 x x2 x 1 x3 1
Addition:
Multiplication:
Division: x3 + x + 1 ) x6 + x5
x3 + x2 + x
x6 + x4 + x3
x5 + x4 + x3
x5 + x3 + x2
x4 + x2
x4 + x2 + x
x
= q(x) quotient
= r(x) remainder
divisordividend
35 ) 1223
10517
Figure 3.55
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
15
Steps:
1) Multiply i(x) by xn-k (puts zeros in (n-k) low order positions)
2) Divide xn-k i(x) by g(x)
3) Add remainder r(x) to xn-k i(x) (puts check bits in the n-k low order positions):
quotient remainder
transmitted codewordb(x) = xn-ki(x) + r(x)
xn-ki(x) = g(x) q(x) + r(x)
Figure 3.56
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
16
Generator polynomial: g(x)= x3 + x + 1Information: (1,1,0,0) i(x) = x3 + x2
Encoding: x3i(x) = x6 + x5
1011 ) 1100000
1110
1011
1110
1011
10101011
010
x3 + x + 1 ) x6 + x5
x3 + x2 + x
x6 + x4 + x3
x5 + x4 + x3
x5 + x3 + x2
x4 + x2
x4 + x2 + x
x
Transmitted codeword:b(x) = x6 + x5 + xb = (1,1,0,0,0,1,0)
Figure 3.57
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
17
g (x ) x 3 x 1
reg 0 reg 1 reg 2++
g3 1
i (x )
g0 1 g1 1 i (x ) x 3 x 2
Encoder for
clock input reg 0 reg 1 reg 20 - 0 0 01 1=i3 1 0 0
2 1=i2 1 1 0
3 0=i1 0 1 1
4 0=i0 1 1 1
5 0 1 0 16 0 1 0 07 0 0 1 0check bits: r0 = 0 r1 = 1 r2 = 0
r(x) = x
Figure 3.58
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
18
b(x)
e(x)
R(x)+ (Receiver)(Transmitter)
Error pattern
Figure 3.59
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
19
1. Single errors: e(x) = xi 0 i n-1If g(x) has more than one term, it cannot divide e(x)
2. Double errors: e(x) = xi + xj 0 i < j n-1
= xi (1 + xj-i )If g(x) is primitive, it will not divide (1 + xj-i ) for j-i 2n-k1
3. Odd number of errors: e(1) =1 If number of errors is odd.If g(x) has (x+1) as a factor, then g(1) = 0 and all
codewords have an even number of 1s.
Figure 3.60
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
20
4. Error bursts of length b: 0000110 • • • • 0001101100 • • • 0
e(x) = xi d(x) where deg(d(x)) = L-1g(x) has degree n-k; g(x) cannot divide d(x) if deg(g(x))>
deg(d(x))
L = (n-k) or less: all will be detected L = (n-k+1): deg(d(x)) = deg(g(x)) i.e. d(x) = g(x) is the only undetectable error pattern, fraction of bursts which are undetectable = 1/2L-2
L > (n-k+1): fraction of bursts which are undetectable
= 1/2n-k
L
ithposition
error pattern d(x)
Figure 3.61
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
21
b
e
r+ (receiver)(transmitter)
error pattern
b
e
r+ (receiver)(transmitter)
error pattern
(a) Single bit input
(b) Vector input
Figure 3.62
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
22
0010000
s = H e = =101
single error detected
0100100
s = H e = = + =011
double error detected100
1 0 1 1 1 0 01 1 0 1 0 1 00 1 1 1 0 0 1
1110000
s = H e = = + + = 0 110
triple error notdetected
011
101
1 0 1 1 1 0 01 1 0 1 0 1 00 1 1 1 0 0 1
1 0 1 1 1 0 01 1 0 1 0 1 00 1 1 1 0 0 1
111
Figure 3.63
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
23
s = H r = He
s = 0 s = 0
no errors intransmission
undetectableerrors
correctableerrors
uncorrectableerrors
(1-p)7 7p3
1-3p 3p
7p
7p(1-3p) 21p2
Figure 3.64
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
24
If dmin= 2t+1, non-overlapping spheres of radius t can be drawn around each codeword; t=2 in the figure
b1 b2o o o o
set of all n-tupleswithin distance t
set of all n-tupleswithin distance t
Figure 3.66
Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks
25
b1 b2 b3 b4 bL-3 bL-2 bL-1 bL. . .
L codewordswritten verticallyin array; thentransmitted rowby row
b1 b2 b3 b4 bL-3 bL-2 bL-1 bL
. . .
A long error burst produceserrors in two adjacent rows
Figure 3.66
26
Required ReadingSection 3.8