Error detection and correction How can the receiver determine if there was an error in the message...

21
Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    215
  • download

    0

Transcript of Error detection and correction How can the receiver determine if there was an error in the message...

Page 1: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Error detection and correction

How can the receiver determine if there was an error in the message the

sender sent?

How can these errors be fixed?

Page 2: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Types of errors

• Single-bit: Only one bit is changed. Very rare.

• Burst: Many bits are changed over a duration of time. More common

Page 3: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Block coding• In block coding, we convert chunks of k

bits, called datawords, into somewhat longer chunks of n words, called codewords.

• Just like when we did line coding at the physical layer to give ourselves synchronization, the fact that there are more codewords than datawords means that some are valid and some are not.

Page 4: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Hamming distance• Researchers who try to develop better and

more efficient error detection schemes use the Hamming distance to measure how different two words of equal bit length are.

• We use XOR to calculate the difference.• When designing a particular coding

scheme, what we use is the minimum Hamming distance between all possible pairs of codewords (dmin).

Page 5: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

dmin and error detection

• What qualifies as a good dmin?

• In order to detect up to s errors in a transmission, dmin must equal s + 1.

• If it is only s, then the received codeword could be mistaken for a valid one. If it is s + 1, it never can be.

• Since error correction requires more information, it requires a bigger dmin. 2s, to be precise.

Page 6: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Linear block codes• Linear block codes are specially designed

codes where the XOR of any two codewords yields another valid codeword.

• To find dmin for any block code, find the valid codeword with the least number of 1s (that has at least 1). dmin is the number of 1s in that codeword.

Page 7: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Simple parity• The simplest linear block code is the parity

check. • n = k + 1.• The extra bit simply encodes whether the

number of 1’s in the data word is odd (parity=0) or even (parity=1).

• The idea is that the total number of 1’s in the codeword is even.

• What is dmin?

Page 8: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Two-dimensional parity• Extends the idea of

parity to allow for detection of larger errors.

• Datawords are organized into a table. Parity bits are calculated for each row and column in the table. If the table is k x r bits, the codeword is (k+1) x (r+1) bits.

QuickTime™ and a decompressor

are needed to see this picture.

Page 9: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Hamming codes• Designed so that dmin = 3, meaning they can

detect two bit errors or correct one bit errors.

• The relationship between n and k is defined such that n = 2m - 1, and k = n - m. m is the number of check bits we want to have.

• Our discussion will focus on C(7, 4).

Page 10: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Generating the Hamming code

• The top four bits of the codeword are the dataword.

• The bottom three bits are calculated as follows:– r0 = a2 + a1 + a0

– r1 = a3 + a2 + a1

– r2 = a1 + a0 + a3

QuickTime™ and a decompressor

are needed to see this picture.

Page 11: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Checking the Hamming code• The receiver gets the

codeword and uses it to calculate three syndrome bits:– s0 = b2 + b1 + b0 + q0

– s1 = b3 + b2 + b1 + q1

– s2 = b1 + b0 + b3 + q2

• The pattern of syndrome bits tells us what bit was in error, so the receiver can fix it.

QuickTime™ and a decompressor

are needed to see this picture.

Page 12: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Cyclic codes

• Cyclic codes are special linear block codes with the property that if you bit shift any codeword, you get a new valid codeword.

• Used exclusively for error detection, but use is very widespread because they are very easy to implement in hardware.

Page 13: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Cyclic Redundancy Check (CRC)

• Once again, for C(7,4)….– Encoding:

• The dataword becomes the top four bits of the codeword.• The bottom three bits are calculated as follows:

– Take the dataword and tack three 0’s onto the end.– This is divided by a pre-arranged divisor.– The remainder becomes the bottom three bits

– Decoding:• Divide the codeword by the divisor. • If the remainder is 0, the dataword is good. If not, there

was an error.

Page 14: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

QuickTime™ and a decompressor

are needed to see this picture.

Page 15: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

QuickTime™ and a decompressor

are needed to see this picture.

Page 16: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

QuickTime™ and a decompressor

are needed to see this picture.

Page 17: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

QuickTime™ and a decompressor

are needed to see this picture.

Page 18: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

QuickTime™ and a decompressor

are needed to see this picture.

Page 19: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

Choosing a divisor• How good a given CRC is at detecting errors depends

on the divisor that is chosen.• Think of a bit pattern in terms of polynomials, so the

pattern 100101 would be x5 + x2 + 1.• Now let’s analyze what happens in terms of polynomial

functions. The codeword received is equal to the sent codeword, c(x), plus the error, e(x).

• To extract the dataword from the codeword, we divide by the divisor, g(x), so:

g(x)Codeword =

g(x)c(x)

+g(x)e(x)

Page 20: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

• By definition, c(x)/g(x) has no remainder.

• So, if Codeword/g(x) has a remainder, there must be an error.

• If it has no remainder, one of two things is true:

• Either e(x) = 0 (good!)

• Or e(x)/g(x) has no remainder(bad!)

• So, we need to pick our divisor, g(x), such that it will only very infrequently lead to the second case.

Page 21: Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?

• Single bit errors.– Any single bit error is xi.– Any polynomial of the form xk + 1 will always have a

remainder when dividing with xi.

• Isolated single bit errors– e(x) = xj + xi = xi(xj-i + 1)

• Odd numbers of errors: Make x - 1 one of the factors• Burst errors:

– e(x) = xj + … + xi = xi(xj-i +… + 1)– We are worried about if (xj-i +… + 1)/(xr + … + 1) has a

remainder or not.– If j-i < r, the remainder will never be 0. (L ≤ r)– If j-i = r, the remainder can be 0 with a probability of (1/2)r-1

– If j-i > r, the remainder can be 0 with a probability of (1/2)r