This document discusses error detection and correction techniques at the data link layer. It covers block coding methods like parity checks and cyclic redundancy checks that add redundant bits to detect errors. Parity checks use a single redundant bit to detect single-bit errors. Cyclic redundancy checks are error detecting codes based on cyclic codes that use a polynomial representation. Checksums are also discussed as an error detection method that adds data segments and checks the resulting sum.
6. 10.1.3 Coding
• Process of adding redundancy for error detection or
correction
• Two types:
o Block codes
• Divides the data to be sent into a set of blocks
• Extra information attached to each block
o Convolutional codes
• Treats data as a series of bits, and computes a code over a
continuous series
• The code computed for a set of bits depends on the current and
previous input
6
7. 10.2 Block Coding
• Message is divided into k-bit blocks
o Known as datawords
• r redundant bits are added
o Blocks become n=k+r bits
o Known as codewords (n)
7
9. 10.2.1 Error Detection
• Example: Let us assume that k = 2 and n = 3.
• Table below shows the list of datawords and codewords
• Assume the sender encodes the dataword 01 as 011 and
sends it to the receiver.
o The receiver receives 011. It is a valid codeword. The receiver extracts the
dataword 01 from it.
o The codeword is corrupted during transmission, and 111 is received (the leftmost
bit is corrupted). This is not a valid codeword and is discarded.
9
A code for error detection
10. XOR Operation
• Main operation for computing error detection/correction
codes
• Similar to modulo-2 addition
10
11. 10.2.1.1Hamming Distance
• Ex: Hamming distance d(10101,11110) is 3
• d(01, 00) = ?
• d(11, 00) = ?
• d(010, 100) = ?
• d(0011, 1000) = ?
• How many 8-bit words are n bits away from 10000111?
11
Hamming Distance between two words is the
number of differences between corresponding bits.
13. 10.2.2 Parity Check
• Most common, least complex
• Single bit is added to a block
• Two schemes:
o Even parity – Maintain even number of 1s
• E.g., 1011 10111
o Odd parity – Maintain odd number of 1s
• E.g., 1011 10110
13
14. Example: Parity Check
14
Suppose the sender wants to send the word world. In
ASCII the five characters are coded (with even parity) as
1110111 1101111 1110010 1101100 1100100
The following shows the actual bits sent
11101110 11011110 11100100 11011000 11001001
15. Example: Parity Check
15
Receiver receives this sequence of words:
11111110 11011110 11101100 11011000 11001001
Which blocks are accepted? Which are rejected? Apply
even parity.
16. 10.2.2 Parity-Check: Encoding/Decoding
• Syndrome is result of 1 bit.
• The syndrome value can be 0 or 1.
• The syndrome is passed to the decision logic analyzer.
• If the syndrome is 0 then no error
• If the syndrome is 1 then error
16
17. Performance of Parity Check
• Can 1-bit errors be detected?
• Can 2-bit errors be detected?
• :
17
18. 10.3 CYCLIC CODES
• 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.
• For example, if 1011000 is a codeword and we cyclically
left-shift, then 0110001 is also a codeword.
18
19. 10.3.1 Cyclic Redundancy Check
• A subset of cyclic codes called the cyclic redundancy
check (CRC),
• Used in networks such as LANs and WANs.
• Example:
19
23. 10.3.2 Polynomial Representation
• More common representation than binary form
• Easy to analyze
• Divisor is commonly called generator polynomial
23
25. 10.4 CHECKSUM
Checksum is the error detection technique.
The data is divided into k segments each of m bits.
Sender:
Step 1: Segments are added using 1’s complement arithmetic to get the sum.
Step 2: The sum is complemented to get the checksum.
Step 3: The checksum segment is sent along with the data segments
Receiver:
Step 1: Segments are added using 1’s complement arithmetic to get sum.
Step 2: The sum is complemented.
Step 3: If the result is zero, the received data is accepted; otherwise discarded
The checksum detects all errors involving an odd number of bits.
It also detects most errors involving even number of bits.
25