DLL Error Detection and Correction

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Error Detection and Correction

Chandrakant Mallick

1
Introduction
• Transform the physical layer to a link responsible for node-to-node (hop-to-
hop) communication.
• Data link layer responsibilities:
– Framing
• Divides the stream of bits received from the network layer into data
units called frames.
– Addressing
• Adds a header to the frame to define the sender and receiver addresses
of the frame.
– Flow Control
• Imposed when the receiver reception data rate is less than the sender
emission data rate.
– Error Control
• Adds reliability to the physical layer.
– Media Access Control
• Determines the device to have control over the link when many devices
2
are connected to this link.
Data link layer responsibilities

3
Errors and Types
• Data can be corrupted during transmission
with binary data : 0 changed to 1 or vice-versa.
• Two types of bit-error
– Single-bit error
•Only one bit in the data unit (such as character, frame) has changed.
– Burst error
•Means that two or more bits in the data unit have changed.
•Length of the burst is measured from the first corrupted bit to the
last corrupted one

4
Errors and Types
•Redundancy
– To be able to detect or correct errors, extra (redundant) bits should be
sent with the data.
• Error Detection vs. Correction
– Detection : check only if an error has occurred. The number of errors
is without importance.
– Correction: need to know the exact number of corrupted bits and
their locations.
• Error Correction techniques:
–Forward Error Correction (FEC) vs. Retransmission
•Retransmission:
–when the receiver detects error(s), it asks the sender to retransmit the message.

5
Error detection
• Need a means to detect if an error has occurred during
transmission.
• Error detection uses the concept of redundancy
– Means adding extra bits for detecting errors at the
destination.
•The data, of m bits, to be sent is called the dataword.
• The r redundant bits are calculated and then added to the
dataword.
• The result is a codeword with n = m + r bits

6
Error detection

7
Error detection
•Four types of redundancy checks are used in data communication
– Simple parity-check code
– Two-dimensional parity check code.
– Cyclical redundancy check (CRC).
– Checksum
• Simple parity check
–Most common and least expensive mechanism for error detection.
– A parity bit is added to every dataword so that the total number
of 1s becomes even => even-parity
•n=m+1
• We can use odd-parity as another alternative.

8
Error detection: Simple parity
check code

9
Simple parity check code
•Example

– Suppose the sender wants to send the word world. In ASCII


the five characters are coded as
1110111 1101111 1110010 1101100 1100100
The following shows the actual bits sent
11101110 11011110 11100100 11011000 11001001
– Now suppose the word world in Example 1 is received by
the receiver without being corrupted in transmission.
11101110 11011110 11100100 11011000 11001001

10
Simple parity check code
The receiver counts the 1s in each character and comes up with even
numbers (6, 6, 4, 4, 4). The data are accepted.
– Now suppose the word world in Example 1 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.
• 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.
– It cannot detect errors where the total number of bits damaged is
even.
• Sent data unit (1000111011) ; received data unit (1110111011)

11
Two-dimensional parity check code
• The dataword is organized in a table.
• For each row and column, 1 parity-check bit is calculated.
• The whole table is sent to the receiver.

•This technique can detect up to three errors anywhere in the table.


– Arrows point to the location of the error(s) ??.
• Errors affecting 4 bits may not be detected.

12
Two-dimensional parity check code

13
Error detection: CRC
• Based on binary division
• CRC added to the data unit so that the resulting data becomes
exactly divisible by a predetermined number
• CRC
– Exactly 1 less bit than the divisor
•The divisor is predefined and agreed on

1. A string of n zeros added to the data unit (divisor n+1 bits).


2. New data divided by divisor where the remainder is the CRC.
3. Replace 0’s by CRC
14
Error detection: CRC
• CRC generator (at the transmitter)
• Data to be transmitted : 100100 => dividend
• Divisor : 1101

• Data will be transmitted as


100100001

15
Error detection: CRC
• CRC checker (at the receiver)
– Received data : 100100001

– Remainder is all zero => assume no errors


– No zero remainder => indicates errors
16
• Divisor
Error detection: CRC
– Usually represented as an algebraic polynomial not as a string of 1s and 0s.

Name Polynomial Application

CRC--8
CRC x8 + x 2 + x + 1 ATM header
CRC--10
CRC x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL
ITU--16
ITU x16 + x12 + x5 + 1 HDLC
x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4
ITU--32
ITU LANs
+ x2 + x + 1

• CRC can detect (??)


1. All burst errors that affect odd number of bits
2. All burst errors of length ≤ degree of polynomial
3. With high probability burst errors > degree of polynomial
17
Error detection: Checksum
• Used in the Internet by several protocols although not used at the data
link layer.
– CRC is also used in other layers than the data link layer
• Checksum at the sender side
– A list of number is to be sent.
– The checksum is calculated as the negative (i.e. complement) sum of
these numbers.
• Initially, the checksum is set to 0.
– The list of number (including the checksum) is then transmitted.
• Checksum at the receiver side
– The receiver computes the negative sum of all the numbers including
the checksum.
– If the sum = 0 => it assumes no errors, otherwise the data is
discarded.

18
Checksum
• One’s complement arithmetic
– Allows the checksum to be expressed as an x-bit word if all
the numbers can be written as an x-bit word.
– If the checksum has more than x bits, the extra leftmost
bits are added to the x rightmost bits (wrapping).
– A negative value can be represented by inverting all bits.
• This is the same as subtracting the number from 2x-1.
• Example
– Represent the number 21 in one’s complement arithmetic
using only four bits?
• 2110 = 101012 which is in 5 bits.
• Wrap the leftmost bit an add it to the four rightmost bits :
(0101 + 1) = 0110 or 6.
19
Error detection: Checksum
• Example (cont’d)
– How to represent the number (-6) in one’s complement arithmetic using only four
bits?
• The negative or complement is found by inverting all the bits: +6 is 0110 => -6 is 1001
(which is 9 if we consider unsigned numbers)
• Another way : (24-1) - 6 = 15 - 6 = 9
– Suppose a list of five 4-bit numbers, (7, 11, 12, 0, 6), is to be sent to a destination.
Describe the checksum procedure at both the sender and the receiver sites.

20
Error detection: Checksum
• Internet checksum
– Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to 0.
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.
– Receiver site:
1. The message (including checksum) is divided into 16-bit words.
2. All words are added using one’s complement addition.
3. The sum is complemented and becomes the new checksum.
4. If the value of checksum is 0, the message is accepted; otherwise, it is rejected.
• Performance
– Easy to calculate and can be computed in hardware
–Not strong as CRC
• The error detection is not possible if one word value is incremented and another word
value is decremented by the same amount.
– The tendency with Internet new protocols is to replace the checksum with CRC.

21
Error Correction
 Single-bit error correction
 Must know the location of the invalid bit
 Example: to correct a single-bit error in an ASCII character, the error correction code must
determine which of the seven bits has changed.
 => should distinguish between 8 states: no error, error in position 1, error in position 2, …, error in
position 7.
 3 redundancy bits are adequate?.
 No, what about errors in the redundancy bits themselves?
 In general
 Data bits (m), redundancy bits (r) => m+r bits to be transmitted..
 r should be able to indicate m+r+1 different state (no error, 1 error, etc).
 => 2 r ≥ m + r + 1
 Example
 If the value of m=7 (as with ASCII-code), the smallest value that satisfies the equation r = 4 : 24 ≥
7+4+1
 Hamming code: how to position the redundancy bits?
 For an ASCII character, redundancy bits are placed at positions which are power of 2 of the 11-bit
sequence.

 Each r bit (redundant bit) is the parity-check bit for one combination of data bits
 Each data bit may be included in more than one parity check calculation
22
Error Correction:
 Single-bit error correction
Hamming code
 Hamming code (cont’d)

 Example

23
Hamming code

24
Error Correction:
• Hamming code (cont’d)
Hamming code
– Suppose that the bit number 7 has been corrupted during transmission
– The receiver recalculate four new VRCs using the same set of bits and the parity
bits.
– The new parity values (r8, r4, r2, r1) indicates the location of the bit error in case a
single-bit error has occurred
– The receiver reverse then the incorrect bit.
–If the new parity values=0 => no error has occurred.

• Hamming code to allow burst error correction needs more redundancy


bits 25

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy