8-ERRORDETECTION Itt300
8-ERRORDETECTION Itt300
8-ERRORDETECTION Itt300
CHAPTER 8
1
Lesson Outcomes
3
Only one bit given data
Types of unit is changed from 1
to 0 or from 0 to 1
Single-bit error
2 or more bits in the
data unit have changed
from 1 to 0 or from 0
to 1
The length of the burst Burst error
is measured from the
first corrupted bit to
the last corrupted bit
Occur in serial
transmission
4
Single-bit error
6
Modular Arithmetic
7
XORing of two single bits or two words
Linear
Block
Coding
Error
Detection
Methods
Cyclic
Checksum
Coding
9
10
Block Coding
11
Datawords and codewords in block coding
13
Process of error detection in block coding
15
Assume the sender encodes the dataword 01 as 011 and
sends it to the receiver. Consider the following cases:
17
Example 3
Find the Hamming distance between two pairs of words:
(000,011) and (10101, 11110)
Solution
1. The Hamming distance, d(000, 011) is 2 because 000
011 is 011 (two 1s)
2. The Hamming distance, d(10101, 11110) is 3 because
10101 11110 is 01011 (three 1s)
18
Block Coding
19
Example 4
Find the minimum HD of the coding in Table 6.1
Solution
1. Find all the Hamming distances
Solution
1. Find all the Hamming distances
23
Linear Block Coding
26
Example 7
Now suppose the word world in Example 6 is received by the
receiver without being corrupted in transmission.
11101110 11011110 11100100 11011000 11001001
The receiver counts the 1s in each character and comes up
with even numbers (6, 6, 4, 4, 4). The data are accepted.
27
Example 8
Now suppose the word world in Example 6 is corrupted
during transmission.
11111110 11011110 11101100 11011000 11001001
The receiver counts the 1s in each character and comes up
with even and odd numbers (7, 6, 5, 4, 4). The receiver
knows that the data are corrupted, discards them, and asks
for retransmission.
28
Exercise
Assuming even parity, find the parity bit for each
of the following data units:
1. 1001011 = 10010110
2. 0001110 = 00011101
3. 1100000 = 11000000
4. 1010101 = 10101010
5. 0011111 = 00111111
29
Two dimensional parity-check code
31
Exercise
Find the parity bits for the following bit pattern, using Two
Dimensional Parity Check. Assume EVEN parity.
Solution
1001011 0
0001100 0
1000000 1
1110111 0
1110000 1
34
Cyclic Coding
35
CRC encoder and decoder
37
Division in CRC encoder (Sender)
40
Solution
1) Sender
41
Solution (cont.)
2) Receiver
42
Cyclic Coding
• Polynomials
– A pattern of 0s and 1s can be represented as a
polynomial with coefficients of 0 and 1
– The power of each term shows the position of the
bit; the coefficient shows the value of the bit
43
A polynomial to represent a binary word
47
Implementation of Checksum
Sender Receiver
• The message is divided into n bits • The message (including checksum)
(usually 16 bits) is divided into n bits (16 bits)
• All words are added using one’s • All words are added using one’s
complement addition complement addition
• The sum is complemented and • The sum is complemented and
becomes the checksum becomes the new checksum
• The checksum is sent with the data • If the value of checksum is 0, the
message is accepted; otherwise, it
is rejected
48
Example 10 Example 11
49
One’s Complement
Present the unsigned numbers between 0 and 2n – 1
using only n bits
50
Example 12
Represent the number 21 in one’s complement arithmetic using
only four bits.
Solution
1) The binary equivalent for 21 is 10101 (needs five bits)
2) Wrap the leftmost bit and add to the four rightmost bits
0101 + 1 = 0110 or 6
51
Example 13
Represent the number -6 in one’s complement arithmetic using
only four bits.
Solution
1) The negative number in one’s complement is found by
inverting all bits of the binary equivalent
2) The binary equivalent for +6 is 0110; -6 is 1001 (or 9 in
unsigned numbers)
3) The complement of -6 is 9
52
Checksum – operation at sender site
53
Example 14
Suppose the following message is to be sent using checksum of 8
bits : 10101001 00111001
Sender site:
The numbers are added using one’s complement arithmetic:
10101001
+ 00111001
------------
Sum 11100010
Checksum 00011101 (1’s complement)
55
Receiver site:
Receiver will adds the three sections using one’s complement
arithmetic. We consider two cases; without errors and with
errors
No errors With errors
Now suppose there is a burst error of length
10101001 5 that affects 4 bits.
00111001 10101111 11111001 00011101
+ 00011101 When the receiver adds the three sections, it
Sum 11 111111 gets
Complement 00000000 10101111
means that the pattern is OK. 11111001
+ 00011101
Partial Sum 1 11000101
Carry + _______1
Sum 11000110
Complement 00111001
means the pattern is corrupted. 56
57
Example 15
Suppose a sender want to send a list of five 4-bit numbers to a
receiver. A set of number is (2,6,9,11,13). Find the checksum at
sender and receiver.
Solution
At sender At receiver
2 2
6 6
9 9
11 11
13 13
CS (initial) 0 CS (received) 4
Sum 41 Sum 45
Wrapped sum 11 Wrapped sum 15
Checksum 4 Checksum 0 58
Note: How to calculate wrapped sum &
checksum
• Wrapped sum
At sender, changed 41 into binary 101001. Hint: Highest number in the
list is 13 (1101) so its have 4 bit only. Bring the rest bit to below &
make addition operation. The same thing at the receiver.
At sender At receiver
101001 1001 101101 1101
+ 10 + 10
1011 11 1111 15
1’s complement 0100 4 1’s complement 0000
59
Example 16
Suppose a sender want to send a list of four hexadecimal
numbers to a receiver. A set of number is (466F, 726F, 757A,
616E). Find the checksum at the sender and receiver.
Solution
At sender At receiver
Carries 1013 Carries 1013
466F 466F
726F 726F
757A 757A
616E 616E
CS (initial) 0000 CS (received) 7038
Sum (partial) 8FC6 Sum FFFE
Carry 1 Carry 1
Wrapped sum 8FC7 Wrapped sum FFFF
Checksum 7038 Checksum 0000 60
Exercise
1. Calculate the checksum at the sender and receiver site for
the following :
61
Solution
Question 1
62
Solution (cont.)
Question 2
63
Image source: Data Communications
And Networking, Forouzan
End of Chapter 8
64