Error Correction Codes Can we fix what is broken? Copyright © 2003-2017 by Curt Hill
The Story Starts with Parity In the olden days, well before computers, the teletype existed to transmit telegrams In transmitted characters over telegraph lines It replaced to older Morse code keys This communication form had many options and was error prone Parity was the first solution Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Parity Simple error detection system Add one parity bit to the data bits, usually at the end Two forms: even and odd Even parity Set the parity bit so that the number of 1 bits is even Odd parity is similar Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Example Consider the following data: 01101100 Even parity: 011011000 Odd parity: 011011001 01110110 Even parity: 011101101 Odd parity: 011101100 Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Options How many bits were being transmitted in a character? How fast were they being transmitted? What parity was being used? How many start and stop bits? The answers to all these questions constitute a transmission protocol The choice of protocol did not matter as both the sender and receiver agreed on the same one Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Teletype and Parity Parity will detect a one bit error Even if it is the parity bit that has the error Errors then triggered a retransmit It cannot detect a two bit error Usually before the two bit errors set in there are several one bit errors This was satisfactory for applications in the early to middle twentieth century Copyright © 2003-2017 by Curt Hill
Is this the best we can do? If we employ multiple error detection bits we can detect multiple bit errors and correct single bit errors How do we correct an error? Since each bit may only have two states 0 or 1 all we have to know is which bit is bad Correct it by reversing it How do find location of the error? Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Basic Scheme Four data bits (0-3) Three syndrome bits (a-c) Each parity bit protects just three of the four A protects 0-2 with parity B protects 1-3 with parity C protects 0,1,3 with parity Each bit is protected by two or three of the parity bits The number of parity bits indicate which bit was in error Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Consider four bits with three error detection bits What happens when any bit is wrong? 2 b a 1 3 c Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill So? If the parity bit is in error, then only one parity bit is flagged Can be ignored, well maybe If a data bit is in error, two or three parity bits will detect it Error in 0 – a, c Error in 1 – a, b, c Error in 2 – a, b Error in 3 – b, c Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Multi-bit Errors? 1 b a 2 3 c If we have a double bit error we can detect but not correct. Adding more parity bits could correct even this. Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Is this too expensive? This almost doubles the number of bits 4 data and 3 check (42%) Doubling the data bits only adds one more to the syndrome Thus: 8 data and 4 syndrome bits (33%) 16 data and 5 syndrome bits (23%) 32 data and 6 syndrome bits (15%) 64 data and 7 syndrome bits (10%) The larger the better Compare this to keeping a redundant copy Copyright © 2003-2017 by Curt Hill
Copyright © 2003-2017 by Curt Hill Finally Error correction has been applied to many areas: Transmission of data Checking or correcting for errors in memory Checking or correcting for errors on disk/tape We covered this because we need it for RAID Copyright © 2003-2017 by Curt Hill