1 / 14

Practical Session 10

Learn about Hamming distance and techniques for reliable data transmission over unreliable channels. Explore the use of redundancy for error detection and correction in digital data.

krountree
Download Presentation

Practical Session 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Architecture and Assembly Language Practical Session 10

  2. Error detection and correction • data transmission via communication channels channel noise  errors may happen • we need techniques that enable reliable delivery of digital data over unreliable communication channels • general idea: add some redundancy (extra data) to a message • this extra data is used • to check consistency of the delivered message • to recover data determined to be corrupted

  3. Hamming Distance Hamming distance (d) between two code words of equal length is anamount of 1-bit changes required to reach from one word to the other (number of 1’s in the XOR between the words) d(000, 011) = 2 000 011 10101 11110 d(10101, 11110) = 3 Minimum Hamming distance is thesmallest 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 d=3

  4. Minimum Hamming Distance d can detectd-1 errors Example: 00000 01011 10101 11110 3 errors can take us from one legal code word to another can detect at least 3-1=2 errors d=3 01011 00000 01000 01010 01011 Minimum Hamming Distance d can fix d-1 erasures 3 erasures can take us from one legal code word to another can detect at least 3-1=2 erasures 01011 00000 0_000 0_0_0 0_0__ Minimum Hamming Distance d can fix errors 2 errors can take us from two different legal code words to the same illegal word 00000 01000 01010 11110 01110 can fix at least floor((3-1)/2)=1 error

  5. Given fourdata words, can we use 5-bit code words for fixing1 error? Answer: yes. We need a hamming distance d=3 to fix 1 error. 00000111001011101011 d(00000,11100)=3 d(11100, 10111)=3 d(00000,10111)=4 d(11100, 01011)=4 d(00000,01011)=3 d(10111, 01011)=3 We can create code words with independent graphs of a single error code words.

  6. Parity Check • Given a data word, a code word is created by adding a parity bit to the end of the data word • d=2 (why?) • Can detect 1 error and fix 1 erasure 0001 1 send: 00_1 1 0011 1 receive: erased bit is a parity of other bits: parity (0001) = 1 1 error occurs

  7. if p0 is wrong, we getp2 p1 p0 =√√x= 001b = 1p0 should be at index 1 if p1 is wrong, we getp1 p1 p0 =√x√= 010b = 2p1 should be at index 2 if p2 is wrong, we getp2 p1 p0 =x√√= 100b = 4p2 should be at index 4 if x0 is wrong, we getp2 p1 p0 =√xx= 011b = 3x0 should be at index 3 … if x3 is wrong, we getp2 p1 p0 =xxx= 111b = 7x3 should be at index 7 Hamming Code (4,3) We assume that there may be at most one error. 7 6 5 4 3 2 1 indexes: code word: 4 data bits: x0 x1 x2 x3 3 parity bits: p0 p1 p2 We calculate: why we interleave bits of data and parity in this way ? Example: We got 0100111 Sender sent 0000111 • p0 = 1 = x3 ⊕x1 ⊕x0 = 0 ⊕ 0 ⊕ 1 = 1 √ • p1 = 1 = x3 ⊕x2 ⊕x0 = 0 ⊕ 1 ⊕ 1 = 0 x • p2 = 0 = x3 ⊕x2 ⊕x1 = 0 ⊕ 1 ⊕ 0 = 1 x p2 p1 p0 =xx√ = 110b = 6 The error bit is at index 6 (from right to left) in the code word  error bit isx2

  8. 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)

  9. Binary Pattern as Polynomial

  10. CRC Polynomials (common)

  11. Sending – Calculation Steps • Generatoris chosen • sequence of bits, of which the first and last are 1 • CRC check sequence is computed by long-division of message by generator • check sequence has 1 fewer bits than generator • Check sequence is appendedto the original message

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

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

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

More Related