View
224
Download
1
Embed Size (px)
Citation preview
ErrorDETECTION
&CORRECTION
Detection in oral communication
Sender Receiver
No, UCLA won today
No, you see LA won today
In verbal communication we use the most likelyinterpretation and only question when there seemto be ambiguities or inconsistencies.
Detection in data communication
Sender Receiver
Program
Even a single bit in error can result in •loading from the wrong address•storing in the wrong address•executing the wrong op code•using the wrong data value
• Detection is probabilistic.
• We’ll never detect ALL errors, only optimize the likelihood of detecting it.
• Our focus is on techniques which detect communications-type errors with the highest probability.
• Correction will follow. Focus on detection.
“All” Errors must be detected
Parity
Databits Parity
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 0 0 0 1 0
•Count the number of 1s.•For EVEN (ODD) parity, set the parity bit to either 1 or 0 to have the total number of 1s EVEN (ODD).E.g. for EVEN parity:
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 0 0 0 1 0 1
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 1 1 1 1 0 0
Detection with parity
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 0 0 0 0 1 0 1
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 0 0 0 1 0 1 Sendertransmits
Error Occurs
Receivergets
Receiver calculates parity. Should be 0! Is 1! … ERRORNo method to determine WHICH bit is in error.
But ONLY NEED TO DETECT.
Double Errors with parity
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 0 0 0 0 1 1 1
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 0 0 0 1 0 1 Sendertransmits
Error Occurs
Receivergets
Receiver calculates parity. Should be 1! Is 1! … ERROR NOT DETETED.
This is a PROBLEM!
So is parity useful?
• Probability– If two events (E1, E2) are independent of one
another, probability of simultaneous occurrence is P(E1) * P(E2).
– P(single bit error) = P(S) = 10-6, • P(two bits in error)= P(S)*P(S) = 10-12
• If two bit errors are independent.
• Parity is useful when bit errors are not independent.
• This is NOT typically true in communications environments.
A PROBLEM!
One more important concern!
• Communications errors are BURSTY.
• This means that neighboring bits are affected by each other and the independence assumption is invalid.
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 0 0 0 1 0 1
___ ___ ___ ___ ___ ___ ___ ___ ___ 1 0 1 1 1 1 1 0 1
A similar approach
1 0 1 0 0 0 1 0 1
0 0 0 0 0 0 1 0 1
0 0 1 0 1 0 1 0 1
1 1 1 0 1 0 1 0 1
0 1 1 0 0 0 0 0 0
Vertical Parity
Catches MORE errors but still misses this one.
CRC Codes
• More complicated to calculate.
• Good at detecting bursty errors.
• Not intuitive.
• Standard and well-known codes.
• Uses a “binary” arithmetic technique
Representing a polynomial in binary
146 xxx
0123456 1100101 xxxxxxx IS
WHICH CAN BE VIEWED AS
1 1 1 10 0 0
A few new operations
ADDITION(No carry)
same as subtraction
11010101001000
0100010
Division(Will it divide?)
0100010 0100011YES
easy
1100010 0100011NOeasy
1100011 1100010YESnot easy
Will divide if the same length!
Put together for division
100010 100011000000
1
100010
Put together for division
100010 100011000000
1
100010
1
Put together for division
100010 100011000000
100001
100010
100000
Put together for division
100010 100011000000
100001
100010
100000100010
Put together for division
100010 100011000000
100001
100010
100000100010
000010
Put together for division
100010 100011000000
1000010
100010
100000100010
0000100Remainder
• A special polynomial named the GENERATOR is used as the divisor.
• The message appended parity bits are the dividend
• Initially the parity bits are all zero.
• After calculating the remainder(CRC), replace the parity bits with the remainder.
Relating this to CRC
Example message
Generator
Message
100010
1000110
PARITY (initially)
00000
Parity will be replaced with remainder.Remainder always ONE less that length of Generator.
100010 100011000000…...…...
100Remainder
100011000100
Message TransmittedOldMessage+NewParity
(same problem)
Receiver checks CRC
100010 100011000100
1000010
100010
100010100010
0Remainder
0 remainder indicates no error detected.Message is extracted and forwarded!
1000110Received message
SummaryUse generator and message to determine CRC
Generator Message Zeros
…….…….
Remainder
Append Remainder(CRC) to message and transmit.
Message Remainder
Receiver calculates remainder. Expects 0.
Generator Message
0
ACCEPTIF 0Remainder
CRC detection of errors
• Remember that CRC finds bursty (and other types of) errors with high probability.
• Although it is not obvious, this is also easy to calculate. … IMPORTANT not to slow the communication process.
• We’ll see how to CORRECT later.