Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

25
Ch 2.7 Error Detection & Correction CS-147 Tu Hoang

Transcript of Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Page 1: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Ch 2.7

Error Detection & Correction

CS-147

Tu Hoang

Page 2: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Error Detection and Correction

• No communication channel or storage device is completely error-free

• As the number of bits per area or the transmission rate increases, more errors occur.

• Impossible to detect or correct 100% of the errors

Ch 2.7 > Introduction

Page 3: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Error Detection and Correction

- 3 Types of Error Detection/Correction Methods

- Cyclic Redundancy Check (CRC)- Hamming Codes- Reed-Solomon (RS)

10011001011 = 1001100 + 1011^ ^ ^Code word information error-checking bits/

bits parity bits/ syndrome/ redundant bits

Ch 2.7 > Introduction

Page 4: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Cyclic Redundancy Check (CRC)

• Mostly used in data communication• Tells us whether an error has occurred, but does

not correct the error.• This is a type of “systematic error detection”

– The error-checking bits are appended to the information byte

Ch 2.7 > Cyclic Redundancy Check

Page 5: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Addition Rules

0 + 0 = 0 Ex: 1011

0 + 1 = 1 +110

1 + 0 = 1 1101

1 + 1 = 0

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 6: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ________

Ex: 1011 | 1001011

^ ^

divisor dividend

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 7: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____1___

Ex: 1011 | 1001011

1011

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 8: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____1___

Ex: 1011 | 1001011

1011

0010

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 9: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____10__

Ex: 1011 | 1001011

1011

00100

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 10: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____101_

Ex: 1011 | 1001011

1011

001001

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 11: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____101_

Ex: 1011 | 1001011

1011

001001

1011

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 12: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____101_

Ex: 1011 | 1001011

1011

001001

1011

0010

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 13: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____1010

Ex: 1011 | 1001011

1011

001001

1011

00101

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 14: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Modulo 2 Arithmetic

• Division ____1010 Quotient

Ex: 1011 | 1001011

1011

001001

1011

00101 Remainder

Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Page 15: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Calculating and Using CRCs

1. Let the information byte F = 1001011

2. The sender and receiver agree on an arbitrary binary pattern P. Let P = 1011.

3. Shift F to the left by 1 less than the number of bits in P. Now, F = 1001011000.

4. Let F be the dividend and P be the divisor. Perform “modulo 2 division”.

5. After performing the division, we ignore the quotient. We got 100 for the remainder, which becomes the actual CRC checksum.

6. Add the remainder to F, giving the message M:

1001011 + 100 = 1001011100 = M

Ch 2.7 > Cyclic Redundancy Check > Calculate CRCs

Page 16: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Calculating and Using CRCs

7. M is decoded and checked by the message receiver using the reverse process.

____1010100 1011 | 1001011100

1011 001001

10010010001011 1011 0000 Remainder

Ch 2.7 > Cyclic Redundancy Check > Calculate CRCs

Page 17: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Hamming Codes1. One of the most effective codes for error-recovery2. Used in situations where random errors are likely to occur3. Error detection and correction increases in proportion to the

number of parity bits (error-checking bits) added to the end of the information bits

code word = information bits + parity bitsHamming distance: the number of bit positions in which two code words differ.

1000100110110001 * * *

Minimum Hamming distance or D(min) : determines its error detecting and correcting capability.

Ch 2.7 > Hamming Codes

Page 18: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Hamming Codes

Hamming codes can always detect D(min) – 1 errors, but can only correct half of those errors.

Ch 2.7 > Hamming Codes

Page 19: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Hamming Codes

EX. Data Parity Code

Bits Bit Word

00 0 00001 1 01110 1 10111 0 110

000* 100001 101*010 110*011* 111

Ch 2.7 > Hamming Codes

Page 20: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Hamming Codes

- Single parity bit can only detect error, not correct it

- Error-correcting codes require more than a single parity bit

Ch 2.7 > Hamming Codes

Page 21: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Hamming Codes

EX. 0 0 0 0 0 0 1 0 1 11 0 1 1 01 1 1 0 1

Minimum Hamming distance = 3

Can detect up to 2 errors and correct 1 error

Ch 2.7 > Hamming Codes

Page 22: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Hamming Codes

- Hamming codes work well when we can reasonably expect errors to be rare events. (ex: hard drives)

- Hamming codes are useless when multiple adjacent errors are likely to occur.

- These errors are called “burst errors” that result from mishandling removable media (ex: magnetic tapes or CDs).

Ch 2.7 > Hamming Codes

Page 23: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Reed-Solomon (RS)

- Operates at block level instead of bit level

- RS(n, k) codes are defined using the following parameters

s = the number of bits in a char (8 bits)

k = the number of s-bit characters comprising the data block

n = the number of bits in the code word- RS(n, k) can correct (n – k)/2 errors in the k information bytes

- EX: RS(255, 223)

can correct up to 16 erroneous bytes in the information block

Ch 2.7 > Reed-Solomon

Page 24: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Summary

- 3 Types of Error Detection/Correction Methods- Cyclic Redundancy Check (CRC)

- Used primarily in communication- Can only detect errors.

- Hamming Codes- Can detect and correct errors.- The more parity bits added, the more errors can be

detected and corrected.- Used to detect errors in memory bits or fixed magnetic disk

drives, in which errors occur randomly.

Ch 2.7 > Summary

Page 25: Ch 2.7 Error Detection & Correction CS-147 Tu Hoang.

Summary

- Reed-Solomon (RS)- Can detect errors that occur in blocks (adjacent errors)- Used to detect errors in removable media such as

magnetic tapes or compact disks, in which “burst errors” occur due to mishandling and environmental stress.

Ch 2.7 > Summary