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

## Presentation on theme: "Ch 2.7 Error Detection & Correction CS-147 Tu Hoang."— Presentation transcript:

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

Error Detection and Correction -3 Types of Error Detection/Correction Methods -Cyclic Redundancy Check (CRC) -Hamming Codes -Reed-Solomon (RS) 10011001011 = 1001100 + 1011 ^^ ^ Code wordinformation error-checking bits/ bits parity bits/ syndrome/ redundant bits Ch 2.7 > Introduction

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

Modulo 2 Arithmetic Addition Rules 0 + 0 = 0Ex:1011 0 + 1 = 1+110 1 + 0 = 11101 1 + 1 = 0 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ________ Ex:1011 | 1001011 ^ ^ divisor dividend Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____1___ Ex:1011 | 1001011 1011 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____1___ Ex:1011 | 1001011 1011 0010 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____10__ Ex:1011 | 1001011 1011 00100 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____101_ Ex:1011 | 1001011 1011 001001 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____101_ Ex:1011 | 1001011 1011 001001 1011 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____101_ Ex:1011 | 1001011 1011 001001 1011 0010 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____1010 Ex:1011 | 1001011 1011 001001 1011 00101 Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

Modulo 2 Arithmetic Division ____1010  Quotient Ex:1011 | 1001011 1011 001001 1011 00101  Remainder Ch 2.7 > Cyclic Redundancy Check > Modulo 2 Arithmetic

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

Calculating and Using CRCs 7.M is decoded and checked by the message receiver using the reverse process. ____1010100 1011 | 1001011100 1011 001001 1001 0010 001011 1011 0000  Remainder Ch 2.7 > Cyclic Redundancy Check > Calculate CRCs

Hamming Codes 1.One of the most effective codes for error-recovery 2.Used in situations where random errors are likely to occur 3.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 bits Hamming distance: the number of bit positions in which two code words differ. 10001001 10110001 * * * Minimum Hamming distance or D(min) : determines its error detecting and correcting capability. Ch 2.7 > Hamming Codes

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

Hamming Codes EX. Data Parity Code BitsBit Word 000 000 011 011 101 101 110 110 000*100 001101* 010110* 011*111 Ch 2.7 > Hamming Codes

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

Hamming Codes EX.0 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 Minimum Hamming distance = 3 Can detect up to 2 errors and correct 1 error Ch 2.7 > Hamming Codes

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

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

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

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