200 likes | 218 Views
Error Detection/Correction. Detection – retransmit please Correction – fix it yourself Hamming codes Two dimensional parity Checksums CRC’s Hamming codes Richard Hamming, BTL, circa Claude Shannon error correcting. Encoding NRZ – Non-return to Zero Use a high signal for a 1
E N D
Error Detection/Correction Detection – retransmit please Correction – fix it yourself Hamming codes Two dimensional parity Checksums CRC’s Hamming codes Richard Hamming, BTL, circa Claude Shannon error correcting
Encoding NRZ – Non-return to Zero Use a high signal for a 1 Use a low signal for a 0 Does not work because:
Encoding Does not work because of: baseline wander clock drift
Manchester encoding logic 0 is indicated by a 0 to 1 transition at the centre of the bit logic 1 is indicated by a 1 to 0 transition at the centre of the bit. signal transitions do not always occur at the bit boundaries, but that there is always a transition at the centre of each bit.
Manchester encoding What bit pattern is encoded?
Manchester encoding 1 1 0 1 0 0 10 10 01 10 01 01
RS-232 25 pin 9 pin rj-45
RS-232 What is this bit stream under RS-232? 0100000111101000011011
RS-232 ASCII character stop bits 01000001111 01000011011 parity bit (odd) start bit
Hamming codes Power-of-two bit positions are parity bits Parity bit N covers all bit positions with the Nth lsb set N=1 first parity bit covers bit positions 1,3,5,7,9… N=2 second parity bit covers 2,3,6,7,10,11
Hamming codes Using even parity and 4 parity bits, what is the hamming code for 0 1 1 0 1 0 1
Hamming codes Using even parity and 4 parity bits, what is the hamming code for 0 1 1 0 1 0 1 1 0 0 0 1 1 0 0 1 0 1 What happens if, when received, the final bit is corrupted?
Checksums when algorithm for computing redundancy information is based on addition, call it a checksum
Internet checksum used in IP, TCP, UDP, ICMP short csum(short buf, int cnt) { int sum=0; while (cnt--) { sum += *buf++; if (sum & 0xffff0000) { sum &= 0xffff; sum++; } } return(~(sum & 0xffff)); } 1 in 64k chance of checksum valid, but bad data
CRC – Cyclic redundancy check In Galois fields Full of flowers Primitive elements Dance for hours n-bit CRC - detects any single error burst <= n bits
CRC – Cyclic redundancy check Message to send: M = 1 0 0 1 1 0 1 0 Polynomial form: P = x**7 + x**4 + x**3 + x Choose a divisor polynomial, DP = ? Create a message: M’ = m * x**k where k == (number of bits in DP) - 1 Calculate P/DP … only care about remainder R Calculate M’ – R this is exactly divisible by DP, and is the message we send Receiver does the division and if != 0, it was an error
CRC – Cyclic redundancy check Message to send: M = 1 0 0 1 1 0 1 0 Polynomial form: P = x**7 + x**4 + x**3 + x Choose a divisor polynomial, DP = x**3 + x**2 + 1 M’ = M * x**3 = 1 0 0 1 1 0 1 0 0 0 0 Divide: 1 0 0 1 1 0 1 0 0 0 0 / 1 1 0 1 Remainder is 101 Subtract R from M’ M’ – R = 1 0 0 1 1 0 1 0 1 0 1 M’ – R is exactly divisible by DP and is what we send
Error detection vs. Error correction? Mainly a function of the cost of an error let all information carry EC overhead when 1. errors more probable 2. empirically observed error patterns are well-handled 3. cost of retransmission is high but in the end, you still need retransmission