Week 4
Week 4
Reference books
Many textbooks on Networking may be consulted
Research papers!
RFCs and Internet drafts
Related to TCP/IP suite and other protocols
Web resources
Tutorials, white papers, reports, etc.
Burst Error
2 or more bits in data units have changed
Error Detection or Correction: Structure of7
Sender and Receiver
Error Detection
Why we need it ?
To avoid retransmission of whole packet or message
What to do if error detected ?
Discard, and request a new copy of the frame:
explicitly or implicitly
Try to correct error, if possible
9
Error Detection
We want only k redundant bits for an n-bit message, where k < < n
In Ethernet, 32-bit CRC for 12,000 bits (1500 bytes)
k bits are derived from the original message
Both the sender and receiver know the algorithm
12
Error Correction
Hamming Distance
Hamming Distance
110011000011001
010111001011001
-------------------------
100100001000000
The Hamming Distance is 3.
This means 3 bits would have to “flip” before we would be unable to detect an
error.
The minimum Hamming distance is the smallest Hamming distance between
all possible pairs in a set of words.
15
Codewords
We do not make use of all of the possible codewords due to the use of check
bits.
This means we can compute all of the legal codewords and determine the
minimum Hamming distance for the set.
In order to detect d errors, we need a distance of d+1.
In order to correct d errors, we need a distance of 2d+1.
16
Consider the parity bit that tells us if the parity of the data is even or odd.
The Hamming Distance would equal 2.
Since it is only one bit, then it is able to identify single errors (if one bit has
flipped).
If two bits have flipped, then the parity bit will report the correct parity for the
data.
17
• Two-dimensional parity
– Detects up to 3-bit errors
– Good for burst errors
Two-Dimensional Parity
Parity
Adding one extra bit to a 7- bits
bit code to balance 1s 0101001 1
extra parity byte for the 1101001 0
entire frame
Catches all 1-, 2- and 3-bit 1011110 1
errors and most 4-bit errors Data
0001110 1
14 redundant bits for a 42-
bit message, in the example 0110100 1
1011111 0
Parity
1111011 0
byte
22
Two-Dimensional Parity
0 1 0 0 0 1 1 1
0 1 1 0 0 0 1 1
0 1 1 0 1 1 1 1
0 1 1 0 0 0 0 0
1 0 0 1 0 0 1 1
0 1 1 0 1 1 0 0
1 1 0 1 0 1 0 0
23
Theory
based on finite-field (binary-valued) arithmetic
bit string represented as polynomial
coefficients are binary-valued
divide bit string polynomial by generator polynomial to generate CRC
Practice
bitwise XOR’s
24
1101 ) 101110001101
1101
remainder bits
1101
1101
00001101
1101
0 correct !
28
1101 ) 101101001101
1101
Two bits
1100
1101
are flipped
1100
1101
1110
1101
111 incorrect !
29
1101 ) 101101011101
1101
Three bits
1100
1101
are flipped
1101
1101
1101
1101
0 incorrectly correct !!!
30
Parity bit 1 covers all bit positions which have the least significant
bit set: bit 1 (the parity bit itself), 3, 5, 7, 9, etc.
Parity bit 2 covers all bit positions which have the second least
significant bit set: bit 2 (the parity bit itself), 3, 6, 7, 10, 11, etc.
Parity bit 4 covers all bit positions which have the third least
significant bit set: bits 4–7, 12–15, 20–23, etc.
Parity bit 8 covers all bit positions which have the fourth least
significant bit set: bits 8–15, 24–31, 40–47, etc.
In general each parity bit covers all bits where the binary AND of
the parity position and the bit position is non-zero.
Hamming Codes (1950 Paper) 33
34
2 6 4
010 110 100
7
3 111 5
011 101
1
001
35
Graphical depiction of the 4 data bits and 3 parity bits and
which parity bits apply to which data bits
36
p1 p2 D1 p4 D2 D3 D5
p1 p2 D1 p3 D2 D3 D4
p1 p2 D1 p4 D2 D3 D4
p1 p2 D1 p3 D2 D3 D4
P1 = D1 XOR D2 XOR D4
P2 = D1 XOR D3 XOR D4
P4 = D2 XOR D3 XOR D4
37
Graphical depiction of the 7 data bits and 4 parity bits and
which parity bits apply to which data bits
38
Example of (11,7)
Correction of Error