1
Block Coding
Messages are made up of k bits.
Transmitted packets have n bits, n > k:
k-data bits and
r-redundant bits.
n = k + r
2
Modulo-2 Arithmetic
Addition and subtraction are described by thelogical exclusive-or operation.
3
Modulo-2 Arithmetic (logical xor)
4
Chapter 10
Error DetectionandCorrection
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Interference
Example causes of interference:
Heat
Noise due to interference (EM fields)
Attenuation
Distortion
Interference causes bit errors.
Bit Error Classifications
Single bit error
Burst error
Single Bit Error
Single bit error
A one is interpreted as a zero (or vice-versa)
Refers to only one bit modified in a specifiedtransmission unit of data
An uncommon type of error for serial data due tothe duration of a bit being much less than theduration of interference.
8
Figure 10.1  Single-bit error
9
Burst Error
More than one bit is damaged by interference.
10
Figure 10.2  Burst error of length 8
11
Error Detection
Detection of errors is necessary to determine ifdata should be rejected.
Possible responses to error detection include:
Retransmission request
Forward error correction (corrected on the receivingend)
Forward correction saves bandwidth & time
12
Redundancy
Extra bits can be included with the datatransmission to assist in the detection andcorrection of errors
For digital transmissions that implies usingblock-coding
13
Redundant Bits
14
Detection vs Correction
Detection is easier than correction
15
Data Coding Schemes
Block coding – described in this course
or
Convolution coding – this is covered inadvanced Math or EE signal processingcourses.
16
Block Coding
Data-words are made up of k bits.
Codewords are made up of k data bits (a data-word) and r redundant bits.
n = k + r
Where n is the number of bits in a codeword
17
Figure 10.5  Datawords and codewords in block coding
18
Examples
No block coding for 10base-T Ethernet,Manchester coding.
4B/5B block coding (Fast Ethernet), MLT-3 linecoding.
8B/10B block coding (Gigabit Ethernet), PAM-5line coding.
19
20
Error Detection With Block Coding
The receiver can detect an error if
The receiver has a list of valid code words
A received codeword is not a valid code word
21
Table 10.2  A code for error correction (Example 10.3)
22
Possible Transmission Outcomes
A codeword is sent and received withoutincident
A codeword is sent but is modified intransmission. The error is detected if thecodeword is not in the valid codeword list.
 A codeword is sent but is modified intransmission. The error is not detected if theresulting new codeword is in the list of validcodewords.
23
Error-Detecting Code
Error detecting code can only detect the typesof errors it was designed to detect. Othertypes of errors may go undetected.
24
The Hamming Distance
The Hamming Distance, d(x,y), between twowords of the same size is the number ofdifferences between corresponding bits.
Examples
d(000,011) = 2
d(10101,11110) = 3
25
Let us find the Hamming distance between two pairs ofwords.
1The Hamming distance d(000, 011) is because 
Example 10.4
2. The Hamming distance d(10101, 11110) is because
26
The minimum Hamming distance is thesmallest Hamming distance between all possible pairs in a set of words.
Note
10.27
Table 10.1  A code for error detection (Example 10.2)
28
Find the minimum Hamming distance of the codingscheme in Table 10.1.
Solution
We first find all Hamming distances.
Example 10.5
The dmin in this case is 2.
29
Table 10.2  A code for error correction (Example 10.3)
30
Find the minimum Hamming distance of the codingscheme in Table 10.2.
Solution
We first find all the Hamming distances.
The dmin in this case is 3.
Example 10.6
31
To guarantee the detection of up to s errorsin all cases, the minimum
Hamming distance in a blockcode must be dmin = s + 1.
Note
32
Hamming Code Notation
What is the maximum number of detectable errorsfor each of the two previous coding schemes?
d-min = 2, s =
d-min = 3, s =
33
Figure 10.8  Geometric concept for finding dmin in error detection
34
To guarantee correction of up to t errors inall cases, the minimum Hamming distance ina block codemust be dmin = 2t + 1.
Note
35
Figure 10.9  Geometric concept for finding dmin in error correction
How many errors can be corrected for the twoexample coding schemes:
d-min = 2, t =
d-min = 3, t =
37
To guarantee correction of up to t errors inall cases, the minimum Hamming distance ina block codemust be dmin = 2t + 1.
Note
38
Example
A code scheme has dmin = 5.
What is the maximum number of detectableerrors?
What is the maximum number of correctableerrors?
39
Linear Block Codes
A linear block code is a code where the logicalexclusive-or of any two valid codewordscreates another valid codeword.
40
Linear Block Codes
The min Hamming distance for a LBC is theminimum number of ones in a non-zero validcodeword.
Exercise:
For each of the next two examples,
Compute the
Hamming distance,
the number of detectable errors,
number of correctable errors
Show that the code is linear
42
Table 10.1  A code for error detection C(3,2)
43
Table 10.2  A code for error correction C(5,2)
44
Parity Check
Count the number of ones in a data word.
If the count is odd, the redundant bit is one
If the count is even, the redundant bit is zero
45
A simple parity-check code is asingle-bit error-detectingcode in whichn = k + 1 with dmin = 2.
Note
46
A simple parity-check code can detect anodd number of errors.
Note
47
Table 10.3  Simple parity-check code C(5, 4)
48
How Useful is a Parity Check?
Detecting any odd number of errors is prettygood, can we do better?
49
2-Dimensional Parity Check
It is possible to create a 2-D parity check codethat detects and corrects errors.
50
Figure 10.11  Two-dimensional parity-check code
51
Figure 10.11  Two-dimensional parity-check code
52
Figure 10.11  Two-dimensional parity-check code
53
Figure 10.11  Two-dimensional parity-check code
Interleaving
 By interleaving the columns into slots, itbecomes possible to
 detect up to n-row errors.
The example is 70%efficient. The efficiency canbe improved by adding more rows.
55
Cyclic Codes
If a codeword is shifted cyclically, the result isanother codeword.
(highest order bit becomes the lowest order bit)
Cyclic codes are linear codes
C(7,4)
Assume d-min = 3.
Answer the following about table 10.6:
 What is the codeword size?
 What is the data-word size?
57
Table 10.6   is this C(7, 4) cyclic?
C(7,4)
 Is the table 10.6 code cyclic?
 Is it linear?
 What is d-min?
 How many detectible errors?
 How many correctible errors?
Hamming Codes
d-min >= 3
Minimum number of detectable errors: 2
Minimum number of correctable errors: 1
For C(n,k),
n = 2^r – 1
r = n – k (number of redundant bits)
k >= 3
Which are Hamming Codes?
 C(7,4)
 C(7,3)
Error Correction
 1. Using CRC codes computing bit syndromes
 2. Using interleaving with multiplexing.
Use a parity bit in each frame
Check for invalid code words
 (see example exercises)
62
Checksum
Adding the codewords together at the sourceand destination.
If the sum at the source and destinationmatch, there is a good chance that no errorsoccurred.
Checksums are not as reliable as the CRC.
63
Checksum Examples
1's complement
16 bit checksum used by the Internet
Sender: Checksum Calculation
1.Divide into 16 bit unsigned words
2.Add the 16 bit words using 1’s complementaddition.
3.Complement the total
4.Send all the above words.
Receiver: Checksum Calculation
1. Divide into 16 bit words
1.Add the 16 bit words and the checksum valueusing 1’s complement arithmetic.
2.The complement of the total should be zero.
Example: Sender
    0x466f
    0x726f
    0x757a
+_______
0x12e58 partial sum
  0x2e59 sum
  0xd1a6 complement
Example: Receiver
    0x466f
    0x726f
    0x757a
    0xd1a6 (sender’s checksum)
+_______
    0x1fffe (partial sum)
     0xffff   (sum)
   0x0000 (complement)