1 / 32

Error Detection and Correction

Error Detection and Correction. 10.1 Introduction. Data can be corrupted Single-bit error: Burst error:. Redundancy. Extra information (redundant bits) can be used to “detect” and “correct” errors Coding (to add redundant bits). Encoding. Decoding. 10.2 Block Coding.

lavey
Download Presentation

Error Detection and Correction

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. Error Detection and Correction

  2. 10.1 Introduction • Data can be corrupted • Single-bit error: • Burst error:

  3. Redundancy • Extra information (redundant bits) can be used to “detect” and “correct” errors • Coding (to add redundant bits) Encoding Decoding

  4. 10.2 Block Coding • Coding schemes can be divided into two broad categories: block coding and convolution coding • Background • Modular arithmetic (modulus N): Use only a limited number of integers [0, 1, 2, …, N-1] • E.g., 7 + 6 in modular-9 arithmetic is 4, or “(7+6) % 9 = 4” • Exclusive OR (XOR) = modular-2 arithmetic

  5. Block Coding • Datawords: messages divided into k-bits blocks • Codewords: k-bit datawords + r-bits redundancy • We have 2n codewords, but use only 2k datawords • There are 2n – 2k invalid codewords (i.e., unused codewords)

  6. Example of Error Detection • Datawords and codewords • Example: sender encodes dataword 01 as 011 • If receiver receives 011, decodes it to 01 • If receiver receives 111 (i.e., there is a single bit error), which is not a valid codeword, detects the error • If receiver receivers 000 (i.e., there are two bits error), decodes it to 00  undetectable errors

  7. Example of Error Correction • Datawords and codewords • Example: sender encodes dataword 01 as 01011 • Receiver received 01001 • Finds the codeword that is closest to 01001 • 01011 has a single-bit difference • 00000  2-bit difference, …, 11110  3-bit difference • Decodes it to 01

  8. Hamming Distance • Hamming distance between two words is the number of differences between corresponding bits • Minimum hamming distance (dmin) is the “smallest” Hamming distance between all possible pairs in a set of words 111 100 000

  9. Hamming Distance for Detection • To guarantee detectionof up to “s” errors, we should have dmin > s

  10. Hamming Distance for Correction • To guarantee correction of up to “t” errors, we should have dmin > 2t

  11. Example • Minimum Hamming distance? • How many bit errors can be detected? • How many bit errors can be corrected?

  12. 10.3 Linear Block Codes • Precise definition is out of scope • Informally, in a linear block code, XOR of any two valid codewords creates another valid codeword • Previous two sets of codewords are linear block codes • Minimum Hamming distance of linear block codes is the minimum number of 1’s in a non-zero codeword

  13. Simple Parity-Check Code • A k-bit dataword is encoded into (k+1)-bit codeword • The extra bit is chosen to make the number of 1’s in the codeword “even” • Simple parity-check code is a single-bit error-detecting code, with dmin = 2 The last bit (0 or 1) is added

  14. Implementation of Simple Parity-Check Code • s0 = b3 + b2 + b1 + b0 + q0 (modulo 2) • If s0 is 1, discard the received codeword

  15. Two-Dimensional Parity Check • Example: four 7-bit datawords become five 8-bit codewords • Can detect up to 3 errors Cannot detect 4 errors

  16. Hamming Codes • We consider hamming codes with dmin = 3 • Detect two errors, or correct one single error • Choose a number m ≥ 3, then • Codeword length n = 2m – 1 • Dataword length k = n – m • Number of check bits r = m • Example: m = 3, n = 7 (=23–1), k = 4 (=7–3) • Dataword “a3a2a1a0”  Codeword “a3a2a1a0 + r2r1r0” • r0 = a2 + a1+ a0 (modulo-2) • r1 = a3 + a2+ a1 (modulo-2) • r2 = a1 + a0+ a3 (modulo-2) Each bit (e.g., a0) is covered by two parity bits (e.g., r0 and r2)

  17. Hamming Codes

  18. Hamming Codes • r0 = a2 + a1+ a0 (modulo-2) • r1 = a3 + a2+ a1 (modulo-2) • r2 = a1 + a0+ a3 (modulo-2) • Calculation of syndrome • s0= b2+ b1+ b0 + q0(modulo-2) • s1= b3+ b2+ b1 + q1 (modulo-2) • s2= b1+ b0+ b3 + q2 (modulo-2) • Decision to correct a single-bit error

  19. Hamming Codes • Example • Received codeword 0100011 and syndrome is 000, what is the dataword? • Received codeword 0011001 and syndrome is 011, what is the dataword?

  20. Hamming Codes • Detect a burst error

  21. 10.4 Cyclic Codes • Linear block codes with the following property • If a codeword is cyclically shifted, the result is another codeword • Our discussion is limited to a typical example, called Cyclic Redundancy Check (CRC) shift

  22. Implementation • Case of CRC with 4-bit dataword, 7-bit codeword

  23. CRC Encoder Result of XOR

  24. CRC Decoder Non-corrupted bits Corrupted bits The same divider as encoder

  25. Hardware Design • CRC encoder and decoder can be easily implemented using shift registers • Encoder example: divisor = 1011 It takes n-k times to get the result

  26. CRC Encoder using Shift Registers • Divisor = 1011

  27. Polynomials • A pattern can be considered as coefficients of a polynomial • Adding and subtracting are done between the coefficients of the same power • Ex:

  28. Division using Polynomials • Encoder = 1001 1011 =

  29. Cyclic Code Analysis • Dataword d(x), codeword c(x), divisor g(x), syndrome s(x), error e(x) • At receiver, received codeword = c(x) + e(x) • After decoding, we have • An error cannot be detected if e(x) is divisible by g(x)

  30. Design of Divisor • Single-bit error: e(x) = xa for some a • Divisor has more than one term and the least coefficient (i.e., of x0) is 1 • Two-bit error: e(x) = xa + xb for some a, b • Divisor should not divide xt+1 • Odd numbers of errors • Divisor should have the factor (x+1) • Burst errors: e(x) = xa (1+ … + xb ) for some a, b • All burst errors of b-a+1 <= r will be detected • All other errors will be detected with probability 1-(1/2)r-1-(1/2)r

  31. 10.5 Checksum • Often used in the Internet protocols • Idea • For data (7, 11, 12, 0, 6), • send (7, 11, 12, 0, 6, -36), where 36 = 7+11+12+0+6 • Receiver checks error by adding all elements • One’s complement • For the case, when the addition results in a large number more than n bits

  32. Checksum Procedure One’s complement for 4-bit binary 1 1 1 1 0 0 0 0 1 0 0 1 9 = – 6 in one’s complement representation

More Related