Presentation is loading. Please wait.

Presentation is loading. Please wait.

Error Correcting Code.

Similar presentations


Presentation on theme: "Error Correcting Code."— Presentation transcript:

1 Error Correcting Code

2 Consider a 16 bit sequence
Consider a 16 bit sequence. We number the bits from left to right, starting with 1. We add parity bits at the powers of 2: 1,2,4,8,16 to make a total of 21 bits. Add a final bit at the end, bit 22. We place the data bits in the other positions in order left to right. Bit 1 is the parity bit for positions that have a low order 1 bit in binary: 1,3,5,7,9,11,13,15,17,19, 21 Bit 2 is the parity bit for positions that have a 1 in the binary position for 2: 2,3, 6,7, 10,11, 14,15, 18,19 Bit 4 is the parity bit for positions that have a 1 in the binary position for 4: 4,5,6,7, 12,13,14,15, 20,21 Bit 8 is the parity bit for positions that have a 1 in the binary position for 8: 8,9,10,11,12,13,14,15, Bit 16 is the parity bit for positions that have a 1 in the binary position for 16: 16,17,18,19,20,21

3 p1 _ _ _ _ _ _ _ _ _ _ p2 _ _ _ _ _ _ _ _ _ p4 _ _ _ _ _ _ _ _ _ p8 _ _ _ _ _ _ _ p16 _ _ _ _ _ Note that each non-parity position is covered by two or more parity bits, namely the ones that correspond to the binary value for that number. For example, 13 is covered by p1, p4, and p8 and 13 =

4 Given a 16 bit number, , we place its bits in the non-parity positions. We calculate the parity bits to create even parity for each group p p p p p P1 = 0 p2 = 1 p4 = 1 p8 = 0 p16 = 0 The final 21 bit number is Finally, we add bit 22 to be an even parity bit for the whole number, in this case a

5 In memory, for the original 16 bit number, we store the 22 bits. The circuits to create the parity bits as we go to memory are quite simple. Then when we retrieve the number, we check the parity of the given patterns. For example, suppose the number we read from memory is this: p1 _ _ _ _ _ _ _ _ _ _ p2 _ _ _ _ _ _ _ _ _ p4 _ _ _ _ _ _ _ _ _ p8 _ _ _ _ _ _ _ p16 _ _ _ _ _ Add the bits in each pattern: p1 = 7, odd; p2 = 9, odd; p4 = 5 odd; p8 = 5, odd; p16 = 4, even. The overall parity is 13, odd. So there is a 1 bit error. We find it by adding the values where the parity bits show error: = 15. Bit 15 is an error and should be flipped to get the correct value: Removing the parity bits we get the correct 16-bit value:

6 If we had the following value read instead, the analysis would be different p1 _ _ _ _ _ _ _ _ _ _ p2 _ _ _ _ _ _ _ _ _ p4 _ _ _ _ _ _ _ _ _ p8 _ _ _ _ _ _ _ p16 _ _ _ _ _ Add the bits in each pattern: p1 = 7, odd; p2 = 8, odd; p4 = 5 odd; p8 = 4, odd; p16 = 4. p1 and p4 indicate an error. However, the overall parity is 12, even, indicating no error. The only way this can happen is if there are two bits wrong. However, there is no way to tell which two bits! If there are more than two bits wrong, there is no way to know this, and it might read as a correct word or have the wrong bit corrected. This is called Single Error Correct, Double Error Detect: SEC/DED. This is commonly used in memory on computers today. Note that for a 64 bit string, 7 bits are needed to correct a single error and one additional one to give the overall parity to create SEC/DED. So memory chips often have 72-bit width.


Download ppt "Error Correcting Code."

Similar presentations


Ads by Google