You are on page 1of 45

Charotar University of Science and Technology (CHARUSAT)

Chandubhai S Patel Institute of Technology (CSPIT)

CE257: DATA COMMUNICATION AND NETWORKING


Unit 7: Error Detection and Correction

By:
Jignesh Patel
jigneshpatel.cse@charusat.org
Error

Types of Errors
• Single bit

• burst

CE257 Unit 7 Jignesh Patel 2


Redundancy
• It represented by extra bits are added to the message
bits.

• It used to detect error.

• Added by sender and removed by receiver.

• It can be derived by coding.

CE257 Unit 7 Jignesh Patel 3


Error detection and Error Correction

CE257 Unit 7 Jignesh Patel 4


Block coding
• Message is divided in blocks.

• One – One mapping

• Code bits > message/data bits

CE257 Unit 7 Jignesh Patel 5


Block coding

Block coding
• How error can be detected?

• Is it possible to detect all errors?

CE257 Unit 7 Jignesh Patel 6


Block coding

Hamming Distance
• Hamming distance is change of bits.

• What should be minimum hamming distance to detect ‘s’


error?

CE257 Unit 7 Jignesh Patel 7


8
Block coding

Linear Block coding


• Definition: XOR operation on two valid codes results in
valid code.

• What is minimum distance?

CE257 Unit 7 Jignesh Patel 9


Linear Block coding

Parity-Check Code
• What is parity?

• Definition:

• How many bits of error can be detected by This code?


A. 1
B. 2
CE257 Unit 7 Jignesh Patel 10
Parity-Check Code
• Example:

• Is it linear code?
A. Yes
B. No
CE257 Unit 7 Jignesh Patel 11
Linear Block coding

Parity-Check Code: Encoder and decoder

CE257 Unit 7 Jignesh Patel 12


13
Linear Block coding

Cyclic Code
• Definition:

CE257 Unit 7 Jignesh Patel 14


Linear Block coding

Cyclic redundancy check Code


• Example:

CE257 Unit 7 Jignesh Patel 15


Linear Block coding

CRC encoder and decoder

CE257 Unit 7 Jignesh Patel 16


17
Cyclic coding

Polynomials
• Polynomials can be used to represent cyclic codes.

• What is degree of polynomials?

CE257 Unit 7 Jignesh Patel 18


Cyclic coding

Polynomials operations
• Adding or subtracting

• Multiply and divide terms

CE257 Unit 7 Jignesh Patel 19


Cyclic coding

Polynomials operations
• Multiply two polynomial • Divide two polynomials
( 𝑥3 + 𝑥+1 ) ( 𝑥+1 )

CE257 Unit 7 Jignesh Patel 20


Cyclic coding

Polynomials operations
• What is reminder of this?

CE257 Unit 7 Jignesh Patel 21


Cyclic coding

Cyclic code analysis


• Dataword: d(x)
• Codeword: c(x)
• Generator: g(x)
• Syndrome: s(x)
• Error: e(x)
• In a cyclic code,
• 1. If s(x) != 0, one or more bits is corrupted.
• 2. If s(x) = 0, either
• a. No bit is corrupted, or
• b. Some bits are corrupted, but the decoder failed to detect them.
CE257 Unit 7 Jignesh Patel 22
Cyclic coding

Cyclic code analysis


Received code word = c(x) + e(x)

CE257 Unit 7 Jignesh Patel 23


Cyclic coding

Detection of single bit error

• Which of the following g(x) values guarantees that a


single-bit error is caught?
a. x + 1
b. x^3
c. 1

CE257 Unit 7 Jignesh Patel 24


Cyclic coding

Detection of single bit error

• g(x) must have more than one term and the coefficient
of x^0 is 1.

CE257 Unit 7 Jignesh Patel 25


Cyclic coding

Detection of Two Isolated Single-Bit Errors

• Let, t = j-i

CE257 Unit 7 Jignesh Patel 26


Cyclic coding

Detection of Two Isolated Single-Bit Errors

• Which of the following g(x) values guarantees that a


Two Isolated single-bit error is caught?
a. x + 1
b. x^3+1
c. x^7+x^6+1

CE257 Unit 7 Jignesh Patel 27


Cyclic coding

Detection of Two Isolated Single-Bit Errors

• generator cannot divide x^t+1 (t between 0 and n-1)

CE257 Unit 7 Jignesh Patel 28


Cyclic coding

Detection of Odd numbers of Errors


• Generator with x+1 as one factor can detect all odd
numbers of errors

• Can only x+1 be good choice as generator?

CE257 Unit 7 Jignesh Patel 29


Cyclic coding

Detection of Burst Errors

• Let

CE257 Unit 7 Jignesh Patel 30


31
Cyclic coding

Requirements for good polynomial generator


1. It should have at least two terms.
2. The coefficient of the term x^0 should be 1.
3. It should not divide x^t+1, for t between 2 and n-1.
4. It should have the factor x + 1.

CE257 Unit 7 Jignesh Patel 32


Cyclic coding

Standard polynomials

CE257 Unit 7 Jignesh Patel 33


Leader Board Results W4S2

34
Cyclic coding

Hardware implementation
Example:

CE257 Unit 7 Jignesh Patel 35


36
Cyclic coding

Hardware implementation

Can we same circuit at receiver side to detect error?


A. Yes
B. No

CE257 Unit 7 Jignesh Patel 37


Checksum

CHECKSUM

CE257 Unit 7 Jignesh Patel 38


39
Checksum

CHECKSUM
Example:
4-bit numbers (7,11,12,0,6)

CE257 Unit 7 Jignesh Patel 40


Checksum

Procedure for CHECKSUM

CE257 Unit 7 Jignesh Patel 41


Checksum

Procedure for CHECKSUM


Is it capable to detect all types of
error?
A. Yes
B. No but better than CRC
C. No and not better than CRC

CE257 Unit 7 Jignesh Patel 42


Checksum

Other CHECKSUM: Fletcher

CE257 Unit 7 Jignesh Patel 43


Checksum

Other CHECKSUM: Adler

CE257 Unit 7 Jignesh Patel 44


Leader Board Results W4S3

45

You might also like