Wireless Networks
Lecture 5
Error Detecting and Correcting Techniques (Part II)
Dr. Ghalib A. Shah
1
Outlines
Review of previous lecture #3
Block Codes
► Hamming
► BCH
► Reed Solmon
ARQ
► Sliding window
► Go-back-N
Summary of today’s lecture
2
Last Lecture Review
Transmission Errors
Parity Check
► Single-bit parity
► 2D parity
Cyclic Redundancy Check
Block Error Code
3
Hamming Code
Designed to correct single bit errors
Family of (n, k) block errorcorrecting codes with
parameters:
►
►
►
►
Block length:
n = 2m – 1
Number of data bits: k = 2m – m – 1
Number of check bits: n – k = m
Minimum distance: dmin = 3
Singleerrorcorrecting (SEC) code
► SEC doubleerrordetecting (SECDED) code
4
Example of Error Detection/Correction
C1
C2
1 1 0 1 1
0 0 0 0 1
XOR
1 1 0 1 0
Hamming distance =3
Received Codeword (Cr) =1 0 0 1 1
C1
Cr
1 1 0 1 1
1 0 0 1 1
XOR
0 1 0 0 0
C2
Cr
0 0 0 0 1
1 0 0 1 1
XOR
1 0 0 1 0
5
Hamming Code Process
Encoding: k data bits + (n k) check bits
Decoding: compares received (n k) bits with
calculated (n k) bits using XOR
► Resulting (n k) bits called syndrome word
► Syndrome range is between 0 and 2(nk)1
► Each bit of syndrome indicates a match (0) or conflict (1)
in that bit position
6
Example of Hamming Encode
Data =00111001
Bit Position
Bit Position
Bit Position
Bit Position
Bit Position
Pos. Number
Pos. Number
Pos. Number
Pos. Number
Pos. Number
Trans. Block
Trans. Block
Trans. Block
Trans. Block
Trans. Block
Check bits
12
12
12
12 11
11
11 10
10
10 999
12
11
10
888
777
666
555
444
33
22
11
Position
1100 1011 1010
1001 1000Code
0111 0110 0101 0100 0011 0010 0001
1100
11001011
1011
10111010
1010
1010 1001
1001
1001 1000
1000
1000 0111
0111
0111 0110
0110
0110 0101
0101
0101 0100
0100
0011
0010
0001
1100
1100
1011
1010
1001
1000
0111
0110
0101
0100 0011
0011 0010
0010 0001
0001
1010
10
000
000
111
111
9
7
0x
x
0
11
11001000
0111
3
0011
XOR
0111
00
0
1x
x
1
7
11
1
1
X
x
1
1
X
X
1
Decoding Hamming
Bit Position
Pos. Number
Trans. Block
Trans. Block
12 11 10
9
8
7
6
5
4
3
2
1
1100 1011 Position
1010 1001 1000 0111Code
0110 0101 0100 0011 0010 0001
1010
10
0
0
0
0
1
1
1
1
9
0
0
1
1
0
1
0
0
1001
7
0111
6
0110
3
0011
XOR
0110
1
1
8
1
1
1
1
1
1
BCH Codes
BCH Discoverer: Bose, Chaudhuri and
Hocquenghem.
Multiple error correcting codes
Generalization of Hamming Code.
Flexibility in choice of parameters
► Block length, code rate
9
BCH Codes
For positive pair of integers m and t, a (n, k)
BCH code has parameters:
► Block length: n =2m – 1
► Number of check bits: n – k <= m t
► Minimum distance:d min >=2t +1
Correct combinations of t or fewer errors
The generator polynomial can be constructed
from the factors of (X2m-1 +1)
10
ReedSolomon Codes
Subclass of nonbinary BCH codes
Data processed in chunks of m bits, called
symbols
An (n, k) RS code has parameters:
► Symbol length: m bits per symbol
► Block length: n = 2m – 1 symbols = m(2m – 1) bits
► Data length: k symbols
► Size of check code: n – k = 2t symbols = m(2t)
bits
► Minimum distance: dmin = 2t + 1 symbols
11
Automatic Repeat Request
Mechanism used in data link control and transport
protocols
Relies on use of an error detection code (such as
CRC)
Flow Control
Error Control
12
Flow Control
Assures that transmitting entity does not overwhelm a
receiving entity with data
Protocols with flow control mechanism allow multiple PDUs
in transit at the same time
PDUs arrive in same order they’re sent
Slidingwindow flow control
► Transmitter maintains list (window) of sequence numbers allowed to
send
► Receiver maintains list allowed to receive
13
Flow Control
Reasons for breaking up a block of data before
transmitting:
► Limited buffer size of receiver
► Retransmission of PDU due to error requires smaller
amounts of data to be retransmitted
► On shared medium, larger PDUs occupy medium for
extended period, causing delays at other sending stations
14
Flow Control
15
Error Control
Mechanisms to detect and correct transmission
errors
Types of errors:
► Lost PDU : a PDU fails to arrive
► Damaged PDU : PDU arrives with errors
16
Error Control Requirements
Error detection
► Receiver detects errors and discards PDUs
Positive acknowledgement
► Destination returns acknowledgment of received, errorfree PDUs
Retransmission after timeout
► Source retransmits unacknowledged PDU
Negative acknowledgement and retransmission
► Destination returns negative acknowledgment to PDUs in error
17
Go-Back-N
Improve Stop-and-Wait by not waiting!
Keep channel busy by continuing to send frames
Allow a window of up to Ws outstanding frames
Use m -bit sequence numbering
If ACK for oldest frame arrives before window is
exhausted, we can continue transmitting
If window is exhausted, pull back and retransmit all
outstanding frames
Alternative: Use timeout
18
Go-Back-N ARQ
4 frames are outstanding; so go back 4
Go-Back-4:
A
fr
0
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
3
fr
4
fr
5
fr
6
fr
7
fr
8
Time
fr
9
B
A
C
K
1
Rnext 0
1
A
C
K
2
2
A
C
K
3
3
out of sequence
frames
3
A
C
K
4
4
A
C
K
5
5
A
C
K
7
A
C
K
6
6
7
A
C
K
8
8
A
C
K
9
9
► Frame transmission are pipe line d to keep the channel busy
► Frame with errors and subsequent out-of-sequence frames are ignored
► Transmitter is forced to go back when window of 4 is exhausted
19
Window size long enough to cover round trip time
Stop-and-Wait ARQ
f0
A
B
Time-out expires
A
C
K
1
Receiver is
looking for
Rnext=0
Go-Back-N ARQ
Time
f1
f0
Four frames are outstanding; so go back 4
fr0 f1 f2
f3
f0 f1 f2 f3 f4 f5 f6
Time
A
B
Receiver is Out-oflooking for sequence
Rnext=0
frames
A
C
K
1
A
C
K
2
A
C
K
3
A
C
K
4
A
C
K
5
A
C
K
6
20
Go-Back-N with Timeout
Problem with Go-Back-N as presented:
► If frame is lost and source does not have frame to
send, then window will not be exhausted and
recovery will not commence
Use a timeout with each frame
► When timeout expires, resend all outstanding frames
21
Go-Back-N Transmitter & Receiver
Receiver
Transmitter
Send Window
...
Frames
transmitted S
last
and ACKed
Srecent
Buffers
Timer
Slast
Timer
Slast+1
Receive Window
Slast+Ws-1
oldest unACKed frame
...
Timer
Srecent
most recent
transmission
...
Slast+Ws-1
max Seq #
allowed
Frames
received
Rnext
Receiver will only accept
a frame that is error-free and
that has sequence number Rnext
When such frame arrives Rnext is
incremented by one, so the
receive window slides forward by
one
22
GobackN ARQ
Acknowledgments
► RR = receive ready (no errors occur)
► REJ = reject (error detected)
Contingencies
► Damaged PDU
► Damaged RR
► Damaged REJ
23