This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Memory ERROR-CORRECTING CODES Computer memories can make errors occasionally due to voltage spikes on the power line or other causes. To prevent such errors, some memories use errordetecting or error-correcting codes. When these codes are used, extra bits are added to each memory word in a special way. When a word is read out of memory , the extra bits are checked to see if an error occured Error Correcting Code Function Hamming Codes
n-bit code word (n = m + r)
m data bits r check bits (to check parity) there are 2n possible code words only 2m code words are valid
parity is the sum of one check bit and selected data bits
may be even or odd used for detecting errors in memory Hamming Distance The number of bit positions in which two codewords differ is called the Hamming distance. IT MEANS: If 2 codewords are a hamming distance d apart, it will require d single-bit errors to convert one into the other. So if a memory read turns up an invalid code, the CPU knows that a memory error has occurred! Hamming distance of the code
The Hamming distance of the complete code is the minimum distance that can be found between any 2 codewords of the code. Example: consider a code in which a single parity bit is appended to the data, such a code has a distance 2. Since we need 2 single-bit errors to go from 1 valid codeword to another. Parity check for single-bit errors
number of parity bits depends on word size
assuming data size (m) is a power of 2, number of required parity bits (r) is log2m + 1 guarantees Hamming distance of 2, i.e., to change one valid code to another valid code, at least 2 bits must be changed. if a valid code gets only one bit Arranging the parity bits For 8-bit data, how many parity bits? Number the bits left right, 1 n Bits numbered with powers of 2 are parity bits; others are data bits. p p d p d 1 2 3 4 5 d d 6 7 p d d d d 8 9 10 11 12 Hamming's Algorithm The bits are numbered at 1 not 0 with bit 1 at leftmost position All bits whose bit number is a power of 2 are parity bits, the rest are used for data Each parity bit checks specific bit positions In general bit b is checked by those bits b1, b2, .....bj such that b1+b2+ .....+bj=b Example bit 5 is checked by bits 1 and 4 because 1+4=5 exercise
Give the Hamming code for the memory word 1111000010101110. Parity examples
Represent decimal 45 as 8-bit binary with even parity. 100111110111 is an odd-parity representation. Correct its single-bit error ...
View Full Document
This note was uploaded on 05/04/2010 for the course CS 333 taught by Professor Alarabi during the Spring '10 term at DeVry Cleveland D..
- Spring '10