Lecture 7 Error Detection and Correction
Lecture 7 Error Detection and Correction
and Correction
1
WHY ERROR DETECTION AND CORRECTION
• Because of attenuation, distortion, noise and interferences,
errors during transmission are inevitable, leading to corruption
of transmitted bits.
• The longer the frame size, the higher the probability of single
bit error and the lower the probability of receiving a frame
without error.
• This clearly emphasises the need for error detection and error
correction.
2
TYPES OF ERRORS
• Error occurs when a bit is altered between transmission and
reception, i.e. a binary 1 is transmitted and a binary 0 is received.
• Two types of errors
Single bit error
• Only one bit gets corrupted, means that only 1 bit of a given data unit
(such as a byte, character, or packet) is changed from 1 to 0 or from 0 to 1.
• Common used in parallel transmission.
3
Burst error:
• More than one bit get corrupted. means that 2 or more bits in
the data unit have changed from 1 to 0 or from 0 to 1.
• More common in serial transmission of data. Occurs when the
duration of noise is longer than the duration of one bit.
Example: Burst error of length 8
4
ERROR DETECTION TECHNIQUES
• Regardless of the design of the transmission system, there will
be errors, resulting in the change of one or more bits in a
transmitted frame.
• The probability that a frame arrives with no bit errors
decreases when the probability of a single bit error increases.
• The probability that a frame arrives with no bit errors
decreases with increasing frame length.
5
ERROR DETECTION TECHNIQUES Ctd…
Error Detection Process
• An error detecting code is
added by a transmitter
• The error detecting code is
checked and re-calculated
by a receiver and compare
it with the value of the
incoming error detection
code.
• A detected error occurs if
and only if there is a
mismatch.
6
• The central concept in detecting or correcting errors is redundancy.
• To be able to detect or correct errors, we need to send some extra
bits with our data.
• These redundant bits are added by the sender and removed by the
receiver.
• Their presence allows the receiver to detect or correct corrupted bits
Note
To detect or correct errors, we need to send extra (redundant) bits
with data
7
8
TYPES OF ERROR DETECTION TECHNIQUES
• Popular Techniques:
– Simple Parity Check
– Two dimensional Parity Check
– Checksum
– Cyclic Redundancy Check (CRC)
9
SIMPLE PARITY CHECK
• The simplest and the most popular error detection scheme
• Appends a parity bit to the end of the data either 0 or 1.
• The value of the bit is selected so that the character has an even number of
1s (even parity) or an odd number of 1s (odd parity)
10
Datawords and Codewords
11
Example
• If the transmitter is transmitting a character G (1011) and using
odd parity, it will append a 1 and transmit 10111.
• The receiver examines the received character and, if the total
number of 1s is odd, assumes that no error has occurred. If
one bit (or any odd number of bits) is erroneously inverted
during transmission (for example, 10111), then the receiver
will detect an error
12
SIMPLE PARITY CHECK Ctd…
RECEIVER
Accept Data
TRANSMITTER
Compute Compute
Parity Bit Parity Bit
1011011 1 1011011 1
Transmission
Media 13
SIMPLE PARITY CHECK Ctd…
• Performance of Simple Parity Check
– It can detect all single bit errors
– The technique is not fool proof against burst errors that inverts more
than one bits.
– If even number of bits are inverted due to error, the error is not
detected.
14
TWO DIMENSIONAL PARITY CHECK
• Two dimensional parity check organizes the block of bits in the
form of a table
• Parity check bits are calculated for each row, which is
equivalent to a simple parity check bit
• Parity check bits are also calculated for all columns
• Both are sent along with the data
• At the receiving end these are compared with the parity bits
calculated on the received data.
15
16
Example 1
17
Example 2
18
Performance of Two dimensional Parity Check
– Extra overhead is traded for better error detection capability
– Two dimensional parity check significantly improves error detection
capability compared to simple parity check
– It can detect many burst errors, but not all.
19
CHECKSUMS
• This is a block code method where a checksum is created
based on the data values in the data blocks to be transmitted
using some algorithm and appended to the data.
• When the receiver gets this data, a new checksum is calculated
and compared with the existing checksum.
• A non-match indicates an error.
20
CHECKSUM
The Sender’s end
• The data is divided into k segments each
of m bits
• The segments are added using ones
complement arithmetic to get the sum.
• The sum is complemented to get the
checksum
• The checksum segment is sent along
with the data segments.
21
CHECKSUM Ctd…
• The Receiver’s End
• All received segments are added
using ones complement arithmetic to
get the sum.
• The sum is complemented
• If the result is zero, the received data
is accepted; otherwise discarded.
22
Example
23
CHECKSUM Ctd…
Performance of Checksum
• The checksum detects all errors involving an odd number of
bits
• It also detects most errors involving even number of bits.
24
CYCLYC REDUNDANCY CHECK (CRC)
• It’s among the most powerful error detecting code.
• Given a dataword of size k
• A codeword of size n
• The size of the dataword is augmented by adding n-k 0s to the right
hand side of the word.
• The n-bit result is fed into the generator
• The generator uses a divisor of size n-k+1, predefined and agreed upon
• The generator divides the augmented dataword by the divisor
(Modulo-2 division).
• The quotient of the division is discarded, the remainder (r2, r1, r0) is
appended to the dataword to create a codeword. 25
CRC Ctd…
• The decoder receives the possibly corrupted codeword.
• A copy of all n bits is fed to the checker which is a replica of the
generator
• The remainder produced by the checker is a Syndrome, n-k bits
which is fed to the decision logic analyser.
• If the Syndrome bits are all 0s, the four leftmost bits of the
codeword are accepted as the dataword (interpreted as no
error)
• Otherwise the four bits are discarded (error)
26
CRC Encoder and Decoder
27
CRC Ctd…
CRC Encoder
• The encoder takes the dataword and augments it with n-k number
of 0s or appends 0s with size of divisor minus one
• It then divides the augmented dataword by a divisor
• By using Module-2 division, of the leftmost bit of the dividend (or
the part used in each step) is 0, the step cannot use the regular
divisor, we need to use an all-0s divisor.
• When there are no bits left to pull down, we have a result.
• The 3-bits remainder forms the check bits (r2, r1, r0) which are
appended to the dataword to create a codeword.
28
CRC Decoder
• The decoder does the same process as the encoder
• The remainder of the division is the syndrome.
• If the syndrome is all 0s, there is no error; the dataword is
separated from the received codeword and accepted.
• Otherwise, everything is discarded.
29
A CRC code with C(7, 4)
30
Example
31
CRC Ctd…
32
Example
• Given the dataword 𝐷 𝑥 = 𝑥 7 + 𝑥 4 +𝑥 3 +𝑥 1 + 1 and the
divisor G 𝑥 = 𝑥 3 + 1. Show the generation of the codeword at
the sender site using binary division
33
CRC Ctd…
CRC Performance
• The advantage of Cyclic Redundancy Check is that it has a very
good performance in detecting single-bit errors, double errors,
and an odd number of errors, and burst errors.
• It can also be easily implemented in hardware and software.
34
ERROR CORRECTION
• While in error detection we are looking only to see if any error
has occurred, In error detection we need to know the exact
number of bits that are corrupted and more importantly, their
location in the message.
• In error correction, the number of errors and the size of the
message are the most important factors
35
ENCODER AND DECODER IN ERROR CORRECTION
36
TYPES OF ERROR CORRECTION
There are two main methods of error correction.
1. Forward error correction
Is the process in which the receiver tries to guess the message
by using redundant bits. This is possible, if the number of errors
is small.
2. Correction by retransmission
Is a technique in which the receiver detects the occurrence of an
error and asks the sender to resend the message. Resending is
repeated until a message arrives that the receiver believes is
error-free (usually, not all errors can be detected).
37
EXAMPLE
• Consider a Codeword
generated by adding three
redundant bits.
• The sender consults the table
(or uses an algorithm) to
create the codeword 01011
• The codeword is corrupted
during transmission, and
01001 is received (error in the
second bit from the right)
38
EXAMPLE Ctd…
• First, the receiver finds that the received codeword is not in
the table.
• This means an error has occurred. (Detection must come
before correction.)
• The receiver, assuming that there is only 1 bit corrupted, uses
the following strategy to guess the correct dataword.
39
EXAMPLE Ctd…
1. Comparing the received codeword with the first codeword in
the table (01001 versus 00000), the receiver decides that the
first codeword is not the one that was sent because there are
two different bits.
2. By the same reasoning, the original codeword cannot be the
third or fourth one in the table.
3. The original codeword must be the second one in the table
because this is the only one that differs from the received
codeword by 1 bit. The receiver replaces 01001 with 01011
and consults the table to find the dataword 01.
40
Thank You!!!
41