Data Commun. & Computer Netw.
Chapter 7: Error Detection & Correction
Lecturer: Nguyen-Son Vo (Ph.D), email: [email protected]
Behrouz A Forouzan, Data Communications and Networking, 5th Edition, McGraw-Hill Education, 2013
1/34
Ch7 – Error Detection & Correction
7.1. Introduction
7.2. Block coding
7.3. Linear block codes
7.4. Cyclic codes
7.5. Checksum
2/34
7.1. Introduction
- Single error
- Burst error
3/34
7.1. Introduction
- The structure of encoder and decoder
4/34
7.1. Introduction
- XOR
5/34
7.2. Block coding
- Datawords and codewords in block coding
The rest are either used for other purposes or unused.
6/34
7.2. Block coding
- Process of error detection in block coding
7/34
7.2. Block coding
- Example
A dataword 01 is sent by a codeword 011:
• If receiving 011 valid codeword it gets 01 correctly
• If receiving 111 not a correct codeword discarded
• If receiving 000 valid codeword, but incorrect dataword
received error undetectable
8/34
7.2. Block coding
- Structure of encoder & decoder in error correction
9/34
7.2. Block coding
- Example
Can correct up to 1 bit corrupted
A dataword 01 is sent by a codeword 01011, if receiving 01001
invalid codeword How to correct?
• XORing the received 01001 with each codeword in the table
• Only the second codeword yields 1 different bit replace
01001 with 01011 get the dataword 01
10/34
7.2. Block coding
- Hamming distance is the number of different bits
between two codewords
• d(000, 011) = 2
• d(10101, 11110) = 3
11/34
7.2. Block coding
- Min Hamming dmin of all possible codeword pairs
dmin = 2
12/34
7.2. Block coding
- Min Hamming dmin of all possible codeword pairs
dmin = 3
13/34
7.2. Block coding
- Detect up to s errors dmin = s+1
- Correct up to t error dmin = 2t+1
- Example:
A code scheme has a Hamming distance dmin = 4. What is the error
detection and correction capability of this scheme?
Detect up to 3 errors (s = 3)
Correct up to 1 error (t = 1)
Part of its capability is wasted
Error correction codewords need an odd dmin (3, 5, 7,…)
14/34
7.3. Linear block codes
- A linear block code: XOR of 2 valid codewords
creates another valid codeword
15/34
7.3. Linear block codes
- Parity-check code (n = k+1, dmin = 2)
16/34
7.3. Linear block codes
- Parity-check code (n = k+1, dmin = 2)
17/34
7.3. Linear block codes
- Example
Assume the sender sends the dataword 1011. The codeword
created from this dataword is 10111, which is sent to the
receiver.
Show all the possible scenarios at the receiver?
1) No error
2) 1 error
3) 2 errors
4) Conclude?
18/34
7.3. Linear block codes
- Two-dimensional parity-check code
19/34
7.3. Linear block codes
- Two-dimensional parity-check code
20/34
7.3. Linear block codes
- Two-dimensional parity-check code
21/34
7.4. Cyclic codes
- Special linear block codes: if a codeword is
cyclically shifted (rotated) another codeword
A CRC code with C(7, 4) 22/34
7.4. Cyclic codes
- How to create a codeword given a dataword?
We need a divisor or a generator polynomial (g = n – k +1 bits)
23/34
7.4. Cyclic codes
- How to create a codeword given a dataword?
24/34
7.4. Cyclic codes
- How to detect an error?
25/34
7.4. Cyclic codes
- How to detect an error?
• Received codeword = c(x) + e(x)
• Received codeword is divided by g(x), we have
c(x) e(x)
+
g(x) g(x)
26/34
7.4. Cyclic codes
- How to detect an error?
c(x) e(x)
+
g(x) g(x)
• Detect a single bit error, i.e., e(x) = xi, i=0, 1,…, n-1?
Which of the following g(x) values guarantees that a
single-bit error is caught? For each case, what is the error
that cannot be caught?
a. x + 1 b. x3 c. 1
27/34
7.4. Cyclic codes
- How to detect an error?
c(x) e(x)
+
g(x) g(x)
• Detect 2 isolated single bit errors, i.e., e(x) = xj + xi = xi(xj-i+1)?
Find the status of the following generators related to 2
isolated single-bit errors?
a. x + 1 b. x4 + 1 c. x7 + x6 + 1 d. x15 + x14 + 1
28/34
7.4. Cyclic codes
- Some standard generator polynomials
• At least two terms and should have the factor x + 1
• Should not divide xt + 1, for t between 2 and n − 1
29/34
7.4. Cyclic codes
- Burst errors x i (x j i ... 1)
x r ... 1
• All burst errors with L ≤ r will be detected.
• All burst errors with L = r + 1 will be detected with
probability 1 – (1/2)r–1.
• All burst errors with L > r + 1 will be detected with
probability 1 – (1/2)r.
Find the suitability of the following generators in relation
to burst errors of different lengths.
a. x6 + 1 b. x18 + x7 + x + 1 c. x32 + x23 + x7 + 1
30/34
Prob. – Ch07
Prob.1: Is Parity-Check Code a trivial case of CRC?
Prob.2: A bit stream 10011101 is transmitted using the standard CRC method
described in the text. The generator polynomial is x3 + 1. Show the actual bit
string transmitted. Suppose the third bit from the left is inverted during
transmission. Show that this error is detected at the receiver’s end.
Prob.3: In CRC, show the relationship between the following entities (size
means the number of bits)?
a) The size of the dataword and the size of the codeword
b) The size of the divisor and the remainder
c) The degree of the polynomial generator and the size of the divisor
d) The degree of the polynomial generator and the size of the remainder
31/34
Prob. – Ch07
Prob.4: What is the Hamming distance for each of the following codewords?
a) d(10000, 00000)
b) d(10101, 10000)
c) d(11111,11111)
d) d(000, 000)
Prob.5: Find the minimum Hamming distance for the following cases
a) Detection of two errors
b) Correction of two errors
c) Detection of 3 errors or correction of 2 errors
d) Detection of 6 errors or correction of 2 errors
32/34
Prob. – Ch07
Prob.6: Prove that the code represented by Table 10.8 is not a linear code. You need
to find only one case that violates the linearity.
Prob.7: Assuming even parity, find the parity bit for each of the following data
units.
a) 1001011
b) 0001100
c) 1000000
d) 1110111
33/34
Prob. – Ch07
Prob.8: Given the dataword 1010011110 and the divisor 10111.
a. Show the generation of the codeword at the sender site.
b. Show the checking of the codeword at the receiver site (assume no error)
Prob.9: Assuming the bit error rate is p, what is the probability of m errors in
an n-bit data unit?
Prob.10: When we have to correct the errors and when we need to detect the
errors and request to transmit again?
34/34