You are on page 1of 92

Error Correction and Detection

Dr. Amrit Pal


VIT Chennai

Dr. Amrit Pal VIT Chennai


Error
 For most applications, a system
must guarantee that the data
received are identical to the data
transmitted

Dr. Amrit Pal VIT Chennai


Error

Dr. Amrit Pal VIT Chennai


Error

Dr. Amrit Pal VIT Chennai


Question
 How one can know whether the
received data is correct or not?

Dr. Amrit Pal VIT Chennai


Question
 How one can know whether the
received data is correct or not?
 What we have to compare with?

Dr. Amrit Pal VIT Chennai


Error Tolerance

Dr. Amrit Pal VIT Chennai


Understand Error Types
 Relation between noise and data
transmission

Dr. Amrit Pal VIT Chennai


Understand Error Types
 Relation between noise and data
transmission

Dr. Amrit Pal VIT Chennai


Understand Error Types
 Relation between noise and data
transmission
 Effect of the noise and duration of
the noise

Dr. Amrit Pal VIT Chennai


Understand Error Types
Effect of the noise and duration
of the noise
Single bit error
Multiple bit error
 Burst Error

Dr. Amrit Pal VIT Chennai


Understand Error Types
Takeaway
 The duration of noise is normally
longer than the duration of 1 bit,
which means that when noise
affects data, it affects a set of
bits.

Dr. Amrit Pal VIT Chennai


Handling errors

Dr. Amrit Pal VIT Chennai


Handling errors
 By Detecting

 By Correcting

Dr. Amrit Pal VIT Chennai


To detect
 We need some extra information,
to check weather the data is
correct or not.

Dr. Amrit Pal VIT Chennai


To detect
 We need some extra information,
to check weather the data is
correct or not.

 EXTRA  Redundant information

Dr. Amrit Pal VIT Chennai


Detection Versus
Correction
 Which is difficult

Dr. Amrit Pal VIT Chennai


Detection Versus
Correction
 Which is difficult

 How to correct (broad categories)


 Forward Error Correction
 Retransmission

Dr. Amrit Pal VIT Chennai


Detection

Dr. Amrit Pal VIT Chennai


Detection

Dr. Amrit Pal VIT Chennai


Detection

Dr. Amrit Pal VIT Chennai


Detection

Dr. Amrit Pal VIT Chennai


Detection

Dr. Amrit Pal VIT Chennai


Detection
 Redundant Data
 Code
 Relationship between data and code

Dr. Amrit Pal VIT Chennai


Modulo 2

Dr. Amrit Pal VIT Chennai


BLOCK CODING

Dr. Amrit Pal VIT Chennai


BLOCK CODING

Dr. Amrit Pal VIT Chennai


BLOCK CODING

n=k+r

Dr. Amrit Pal VIT Chennai


BLOCK CODING

n=k+r

Dr. Amrit Pal VIT Chennai


BLOCK CODING

Dr. Amrit Pal VIT Chennai


BLOCK CODING
 We divide our message into
blocks, each of k bits
 Add r redundant bits to each block
to make the length n = k + r

Dr. Amrit Pal VIT Chennai


Process of error detection
in block coding

Dr. Amrit Pal VIT Chennai


BLOCK CODING
 Valid and Invalid code

Dr. Amrit Pal VIT Chennai


BLOCK CODING

 Valid and Invalid code

Consider the following cases:


 Sender sends 01011
 What if receiver receives
 011
 111
 000
Dr. Amrit Pal VIT Chennai
BLOCK CODING

 Valid and Invalid code

Consider the following cases:


 Sender sends 01011
 What if receiver receives
 011
 111
 000
Dr. Amrit Pal VIT Chennai
BLOCK CODING

 Valid and Invalid code

Consider the following cases:


 Sender sends 01011
 What if receiver receives
 011
 111
 000
Dr. Amrit Pal VIT Chennai
BLOCK CODING

 Valid and Invalid code

Consider the following cases:


 Sender sends 01011
 What if receiver receives
 011
 111
 000
Dr. Amrit Pal VIT Chennai
BLOCK CODING
 Consider the following cases:
 Sender sends 01011
 What if receiver receives
 011
 111
 000
An error-detecting code can detect only the
types of errors for which it is designed; other
types of errors may remain undetected.

Dr. Amrit Pal VIT Chennai


BLOCK CODING
Error Correction
 Where is the error
 We requires more information
to decide this.
 More redundant data is
required

Dr. Amrit Pal VIT Chennai


BLOCK CODING
Error Correction
 Where is the error
 We requires more information
to decide this.
 More redundant data is
required

Dr. Amrit Pal VIT Chennai


Hamming Distance
 The Hamming distance between two
words is the number of differences
between corresponding bits.

Dr. Amrit Pal VIT Chennai


Hamming Distance
 The minimum Hamming distance is the
smallest Hamming distance between
all possible pairs in a set of words.

Dr. Amrit Pal VIT Chennai


Hamming Distance

Dr. Amrit Pal VIT Chennai


Hamming Distance
 To guarantee the detection of up to s
errors in all the cases, the minimum
Hamming distance in a block code
must be dmin = s + 1.

Dr. Amrit Pal VIT Chennai


Linear Block Codes
 A linear block code is a code in which
the exclusive OR (addition modulo-2)
of two valid codewords creates another
valid codeword

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code
 The extra bit, called the parity bit, is
selected to make the total number of
1s in the codeword even.

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code
 The extra bit, called the parity bit, is
selected to make the total number of
1s in the codeword even.

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
r0= 𝑎3 + 𝑎2 + 𝑎1+a0
Code
S0= 𝑎3 + 𝑎2 + 𝑎1+a0+r0

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code
 If the even number of bits get changed
 A simple parity-check code can detect
an odd of number of errors.

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code
 If the even number of bits get changed
 A simple parity-check code can detect
an odd of number of errors.

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Simple Parity-Check
Code

Dr. Amrit Pal VIT Chennai


Hamming Codes

Dr. Amrit Pal VIT Chennai


Hamming Codes

Dr. Amrit Pal VIT Chennai


Hamming Codes
r2=a3+a2+a1
r1=a2+a1+a0
r0=a0+a3+a1

Dr. Amrit Pal VIT Chennai


Hamming Codes
r2=a3+a2+a1
r1=a2+a1+a0
r0=a0+a3+a1

s2=a3+a2+a1+r2
s1=a2+a1+a0+r1
s0=a0+a3+a1+r0

Dr. Amrit Pal VIT Chennai


Hamming Codes

s2=a3+a2+a1+r2

s1=a2+a1+a0+r1

s0=a0+a3+a1+r0

Dr. Amrit Pal VIT Chennai


Hamming Codes

s2=a3+a2+a1+r2

s1=a2+a1+a0+r1

s0=a0+a3+a1+r0

Dr. Amrit Pal VIT Chennai


Dr. Amrit Pal VIT Chennai
Cyclic Redundancy
Check

Dr. Amrit Pal VIT Chennai


Cyclic Redundancy
Check

Dr. Amrit Pal VIT Chennai


Cyclic Redundancy
Check

Dr. Amrit Pal VIT Chennai


Cyclic Redundancy
Divisor=1011 Check
Data=1001
Augmented Bits=000
Remember XOR operation

Dr. Amrit Pal VIT Chennai


Divisor=1011
Data=1001
Augmented Bits=000
Cyclic Redundancy
Remember XOR operation

1011|1001000
Check

Dr. Amrit Pal VIT Chennai


Divisor=1011
Data=1001
Augmented Bits=000
Cyclic Redundancy
Remember XOR operation
1
1011|1001000
Check
1011

Dr. Amrit Pal VIT Chennai


Divisor=1011
Data=1001
Augmented Bits=000
Cyclic Redundancy
Remember XOR operation
1
1011|1001000
Check
1011
010

Dr. Amrit Pal VIT Chennai


Divisor=1011
Data=1001
Augmented Bits=000
Cyclic Redundancy
Remember XOR operation
10
1011|1001000
Check
1011
0100
0000

Dr. Amrit Pal VIT Chennai


Divisor=1011
Data=1001
Augmented Bits=000
Cyclic Redundancy
Remember XOR operation
10
1011|1001000
Check
1011
0100
0000

Dr. Amrit Pal VIT Chennai


Cyclic Redundancy
Check

Dr. Amrit Pal VIT Chennai


Cyclic Redundancy
Check

Dr. Amrit Pal VIT Chennai


Cyclic Redundancy
Check

Dr. Amrit Pal VIT Chennai


A polynomial to represent a
binary word

Dr. Amrit Pal VIT Chennai


CRC division using
polynomials

Dr. Amrit Pal VIT Chennai


CRC division using
polynomials

Dr. Amrit Pal VIT Chennai


CHECKSUM
 Based on the concept of redundancy
 Example:
 If the set of numbers is (7, 11, 12, 0, 6), we
send (7, 11, 12,0,6,36), where 36 is the
sum of the original numbers.

Dr. Amrit Pal VIT Chennai


CHECKSUM
 Based on the concept of redundancy
 Example:
 If the set of numbers is (7, 11, 12, 0, 6), we
send (7, 11, 12,0,6,36), where 36 is the
sum of the original numbers.

 The receiver adds the five numbers and


compares the result with the sum.
Dr. Amrit Pal VIT Chennai
CHECKSUM
Using One's Complement

Dr. Amrit Pal VIT Chennai


CHECKSUM
Using One's Complement
 How can we represent the number 21 in
one's complement arithmetic using only four
bits?

Dr. Amrit Pal VIT Chennai


CHECKSUM
Using One's Complement
 How can we represent the number 21 in
one's complement arithmetic using only four
bits?
 The number 21 in binary is 10101.
 Wrap the leftmost bit and add it to the four
rightmost bits.
 We have (0101 + 1) = 0110 or 6

Dr. Amrit Pal VIT Chennai


CHECKSUM
Using One's Complement
 The unit is divided into k sections, each of n
bits.
 All sections are added together using one’s
complement to get the sum.
 The sum is complemented and becomes the
checksum.
 The checksum is sent with the data

Dr. Amrit Pal VIT Chennai


CHECKSUM
Using One's Complement

Dr. Amrit Pal VIT Chennai


CHECKSUM
Using One's Complement
 The unit is divided into k sections, each of n
bits.
 All sections are added together using one’s
complement to get the sum.
 The sum is complemented.
 If the result is zero, the data are accepted:
otherwise, they are rejected.

Dr. Amrit Pal VIT Chennai


CHECKSUM
Using One's Complement

Dr. Amrit Pal VIT Chennai


References
 Forouzan Behrouz, A. (2008). Data Communication and
networking.
 Tanenbaum, A. S. (2011). Computer Networks, /Andrew S.
Tanenbaum, David J. Wetherall. Cloth: Prentice Hall.

Dr. Amrit Pal VIT Chennai

You might also like