Data Communication - 8th Lecture
Data Communication - 8th Lecture
1 2
❑ If we need to correct one single error in an 8-bit data unit, we need to consider eight
possible error locations; if we need to correct two errors in a data unit of the same size,
we need to consider 28 possibilities.
3 4
1
11/20/2023
✓ Coding
Redundancy is achieved through various coding schemes.
The sender adds redundant bits through a process that creates a relationship between the
redundant bits and the actual data bits.
The receiver checks the relationships between the two sets of bits to detect or correct the errors. Figure shows the general idea of coding.
5 6
✓ Error Detection
Figure. Process of error detection in block coding
To detect error, the following two conditions are needed to be met:
1. The receiver has (or can find) a list of valid codewords. ✓ Hamming Distance
2. The original codeword has changed to an invalid one. The Hamming distance between two words (of the same size) is the number of differences between
the corresponding bits. We show the Hamming distance between two words x and y as d(x, y).
An error-detecting code can detect only the types of errors for which it is designed; other types of
errors may remain undetected. Hamming distance is a value greater than zero. Hamming distance between the received codeword
and the sent codeword is the number of bits that are corrupted during transmission.
7 8
2
11/20/2023
If the minimum distance between all valid codewords is s + 1, the received codeword cannot be
erroneously mistaken for another codeword.
9 10
11 12
3
11/20/2023
13 14
✓ Few Linear Block Codes (Contd.) ✓ Few Linear Block Codes (Contd.)
❑ Simple Parity-Check Code (Contd.) ❑ Simple Parity-Check Code (Contd.)
Example (Contd.): Let us assume that k = 2 and n = 3. Fig-1 shows the list of Example (Contd.): The code in Fig-2 is also a parity-check code with k = 4 and n
datawords and codewords. We can assume, the sender encodes the dataword = 5.
01 as 011 and sends it to the receiver. We also can consider the following cases:
1. The receiver receives 011. It is a valid codeword. The receiver extracts the
dataword 01 from it.
2. The codeword is corrupted during transmission, and 111 is received (the
leftmost bit is corrupted). This is not a valid codeword and is discarded. 3. The
codeword is corrupted during transmission, and 000 is received (the right two bits
are corrupted). This is a valid codeword. The receiver incorrectly extracts the
dataword 00. Two corrupted bits have made the error undetectable.
Fig-2 Simple parity-check code C(5, 4)
15 16
4
11/20/2023
17 18
✓ Few Linear Block Codes (Contd.) ✓ Few Linear Block Codes (Contd.)
19 20
5
11/20/2023
21 22
✓ Few Linear Block Codes (Contd.) ✓ Few Linear Block Codes (Contd.)
First let us find the relationship between n and k in a Hamming code. We need to
choose an integer m >= 3. The values of n and k are then calculated from m as
n = 2m - 1 and k ::: n - m. The number of check bits r =m.
For example, if m =3, then n ::: 7 and k::: 4. This is a Hamming code C(7, 4) with
dmin =3. Table shows the datawords and codewords for this code.
23 24
6
11/20/2023
✓ Few Linear Block Codes (Contd.) ✓ Few Linear Block Codes (Contd.)
❑ Cyclic Codes ❑ Cyclic Codes
Cyclic codes are special linear block codes with one extra property. In a cyclic Cyclic codes are special linear block codes with one extra property. In a cyclic
code, if a codeword is cyclically shifted (rotated), the result is another codeword. code, if a codeword is cyclically shifted (rotated), the result is another codeword.
For example, if 1011000 is a codeword and we cyclically left-shift, then 0110001 For example, if 1011000 is a codeword and we cyclically left-shift, then 0110001
is also a codeword. In this case, if we call the bits in the first word a0 to a6, and the is also a codeword. In this case, if we call the bits in the first word a0 to a6, and the
bits in the second word b0 to b6, we can shift the bits by using the following: In bits in the second word b0 to b6, we can shift the bits by using the following: In
the rightmost equation, the last bit of the first word is wrapped around and the rightmost equation, the last bit of the first word is wrapped around and
becomes the first bit of the second word b0 to b6, we can shift the bits by using the becomes the first bit of the second word b0 to b6, we can shift the bits by using the
following: following:
b1 = a0 b2 = a1 b3 = a2 b4 = a3 b5 = a4 b6 = a5 b0 = a6 b1 = a0 b2 = a1 b3 = a2 b4 = a3 b5 = a4 b6 = a5 b0 = a6
In the rightmost equation, the last bit of the first word is wrapped around and In the rightmost equation, the last bit of the first word is wrapped around and
becomes the first bit of the second word. becomes the first bit of the second word.
25 26
27 28
7
11/20/2023
➢ Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to O.
3. All words including the checksum are added using one's complement
addition.
4. The sum is complemented and becomes the checksum.
5. The checksum is sent with the data.
Fig: Checksum
29 30
31 32
8
11/20/2023
Figure. Checksum
Algorithm to calculate a traditional checksum
33 34
COMPUTER ARCHITECTURE
Thanks
35