Presentation is loading. Please wait.

Presentation is loading. Please wait.

Practical Session 10 Error Detecting and Correcting Codes.

Similar presentations


Presentation on theme: "Practical Session 10 Error Detecting and Correcting Codes."— Presentation transcript:

1 Practical Session 10 Error Detecting and Correcting Codes

2 Error detection and correction channel noise communication channels are subject to channel noise, and thus errors may be introduced during data transmission techniques that enable reliable delivery of digital data over unreliable communication channels we need techniques that enable reliable delivery of digital data over unreliable communication channels detecting errors reconstructing the original data

3 Error detection and correction redundancy extra data General idea: add some redundancy (i.e. some extra data) to a message This extra data is used – to check consistency of the delivered message – to recover data determined to be corrupted – to recover data determined to be corrupted

4 Hamming Distance Hamming distance (d) amount of 1-bit changes Hamming distance (d) between two code words of equal length is an amount of 1-bit changes required to reach from one word to the other number of 1’s in the XOR between the words 000 011 d(000, 011) = 2 10101 11110 d(10101, 11110) = 3

5 Hamming Distance Minimum Hamming distance smallest Hamming distance all possible pairs Minimum Hamming distance is the smallest Hamming distance between all possible pairs in a set of words. Example Given the following coding scheme, let’s find the minimum Hamming distance. 00000 01011 10101 11110 d(00000,01011)=3 d(00000,10101)=3 d(00000,11110)=4 d(01011,10101)=4 d(01011,11110)=3 d(10101,11110)=3 minimum Hamming distance is d=3

6 Hamming Distance - Error Detection Minimum Hamming Distance: d Can detect (at least) d-1 errors 000000100001010 Example 00000 01011 10101 11110 d=3 3 errors can take us from one legal code word to another 01011

7 Hamming Distance - Erasures Fixing Minimum Hamming Distance: d Can fix (at least) d-1 erasures 000000_0000_0_001011 Example 00000 01011 10101 11110 d=3 3 erasures can take us from one legal code word to another 0_0__

8 Hamming Distance - Error Correction Minimum Hamming Distance: d Can correct (at least) errors 0000001000 Example 00000 01011 10101 11110 d=3 2 errors can take us from two different legal code words to the same illegal word 1111001110 01010

9 Hamming Distance - Example Given four data words, can we use 5-bit code words for fixing 1 error? independent graphs of a single error code words Answer: yes. We need a hamming distance d=3 to fix 1 error. We can create code words with independent graphs of a single error code words. d(00000,11100)=3 d(11100, 10111)=3 d(10111, 01011)=3 d(00000,10111)=4 d(11100, 01011)=4 d(00000,01011)=3 00000000010001000100 01000 10000 11100 11000 10100 0110011110 11101 10111 10110 10101 1001111111 00111 01011 01010 01001 0111100011 11011

10 Parity Check 00011 00111 parity bit Given a data word, a code word is created by adding a parity bit to the end of the data word d=2 d=2 (why?) Can detect odd number of errors (1,3,5,…) Can detect odd number of errors (1,3,5,…) send: or receive: 1 or 3 errors occur Code word Data word 0 000000000 1 000110001 1 001010010 0 001100011 11011

11 Longitudinal Redundancy Checking (LRC) Block Check Adds an additional character called Block Check Character (BCC) Character (BCC) to a data word. 1.determine vertical and horizontal parity bits Even parity calculated for each row (1 if number of ‘1’ bits is 1,3,5,7,…) Odd parity calculated for each column (1 if number of ‘1’ bits is 0,2,4,6,…) 2.calculate BCC character 1st bit of BCC  number of 1’s in the 1st bit of characters 2nd bit of BCC  number of 1’s in the 2ndt bit of characters … 8’th bit of BCC  number of 1’s in the parity bits column Example data word suppose a data word “DATA” ASCII 1000100 1000001 1010100 10000011101111 Letter D A T ABCC Parity bit 0 1 00 code word a code word is “DATA”11011111

12 2 errors occurred Longitudinal Redundancy Checking (LRC) Block Check Adds an additional character called Block Check Character (BCC) Character (BCC) to a data word. d=2 d=2 (why?) ASCII 1000100 1000001 1010100 10000011101111 Letter D A T ABCC Parity bit 0 1 00 ASCII 1000101 1000001 1010101 10000011101111 Letter D A T ABCC Parity bit 1 0 0 These two errors would not change BCC character

13 Cyclic Redundancy Check CRC is an error-detecting code Given a data, its non trivial (cryptographic) challenge to find another data with the same CRC code.  CRC can protect data (even from deliberate damage)

14 Binary Pattern as Polynomial

15 CRC Polynomials (common) CRC-8-ATM x 8 + x 2 + x + 1 CRC-16-IBM x 16 + x 15 + x 2 + 1 CRC-16-CCITT x 16 + x 12 + x 5 + 1 CRC-32-IEEE 802.3 x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1

16 Sending – Calculation Steps 1.Generator 1.Generator is chosen – sequence of bits, of which the first and last are 1 2.CRC check sequence is computed 2.CRC check sequence is computed by long- division of message by generator – check sequence has 1 fewer bits than generator appended 3.Check sequence is appended to the original message

17 Sending – Calculation Steps Compute 8-bit CRC a message ‘W’ (0x57). 1.Select Generator: CRC-8-ATM 1.x 8 + x 2 + x + 1 = 100000111 2.‘W’ is 01010111= x 6 + x 4 + x 2 + x + 1 3.Extend ‘W’ with 8 bits: 0101011100000000 4.Perform XOR of the word get in step (3) by generator – CRC code is the remainder 5.Append CRC code to ‘W’

18 Generating CRC Code Generating CRC Code long-division of message by generator 0101011100000000100000111 10100010 CRC Code: 10100010 100000111 001011011000000 100000111 0011010110000 100000111 01010101100 100000111 0010100010 xor Each time apply XOR on the extended message, when place a generator from the left-most ‘1’ bit of the extended message Stop when CRC code has 1 fewer bits than generator

19 Receiving – Calculation Steps Append CRC code to the message: 0101011110100010 Perform long division by the generator reminder is not 0 If the reminder is not 0: an error occurred 0101011110100010100000111 result: 00000000 100000111 xor There is no errors in received message.


Download ppt "Practical Session 10 Error Detecting and Correcting Codes."

Similar presentations


Ads by Google