Computer Networks
Data Link Layer
LECTURE 13
DATA LINK LAYER
DATA LINK CONTROL (DLC)
Error Detection Methods
Parity-Check Code
Cyclic Redundancy Check
Checksum
Error Detection
Simple Parity Check
A simple parity-check code is a single-bit error-
detecting code in which n = k + 1.
Example
Let us look at some transmission scenarios. Assume
the sender sends the dataword 1011. The codeword
created from this dataword is 10111, which is sent to
the receiver. We examine five cases:
1. No error occurs; the received codeword is 10111. The
syndrome is 0. The dataword 1011 is created.
2. One single-bit error changes a1 . The received
codeword is 10011. The syndrome is 1. No dataword is
created.
3. One single-bit error changes r0 . The received codeword is
10110. The syndrome is 1. No dataword is created.
Example (contd.)
4. An error changes r0 and a second error changes a3 .
The received codeword is 00110. The syndrome is 0. The
dataword 0011 is created at the receiver. Note that
here the dataword is wrongly created due to the
syndrome value.
5. Three bits—a3, a2, and a1—are changed by errors.
The received codeword is 01011. The syndrome is 1.
The dataword is not created. This shows that the simple
parity check, guaranteed to detect one single error, can
also find any odd number of errors.
Performance
A Simple parity check can detect all single-bit errors.
It can detect burst errors only if the total number of
errors in each data unit is odd.
Cyclic Redundancy Check
•Cyclic Redundancy Check (also called polynomial code)
•Based on modulo-2 binary division
• No carries (because it's modulo-2)
• Subtraction is equivalent to XOR
Division in CRC encoder
Division in the CRC decoder for two cases
Checksum
Example:
IP header
1. The data unit is divided into k sections, each of n bits
2. All sections are added using 1’s complement
3. The sum is complemented
4. The checksum is sent with data
Checksum: Sending
Suppose the following block of 16 bits is to be sent using
a checksum of 8 bits.
10101001 00111001
The numbers are added using one’s complement
10101001
00111001
------------
Sum 11100010
Checksum 00011101 (Take 1’s complement of Sum)
The pattern sent is 10101001 00111001 00011101
Checksum: Receiving
Now suppose the receiver receives the pattern sent and
there is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all
1s, which, after complementing, is all 0s and shows
that there is no error.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the pattern is
OK.