Lecture7
Lecture7
1
Error Detection And Correction
• The small size of the transistors, combined
with cosmic ray effects causes occasional
errors in stored information in large, dense
RAM chips.
• These errors can be detected and corrected
by employing error-detecting and –correcting
codes in RAMs.
2
Parity Bit
• To detect errors in data communication
and processing, an additional bit is
sometimes added to a binary code word to
define its parity.
• A parity bit is the extra bit included to
make the total number of 1’s in the
resulting code word either even or odd.
3
Parity Bit Example
4
Characteristics of Parity
• Even parity is more common
5
Parity Bit Generating and Checking
• An even parity bit is generated at the sending end for
all 7-bit ASCII characters
9
Hamming Code Example (Cont.)
10
PAL is a registered trademark of Lattice Semiconductor Corp.
Hamming Code Example (Cont.)
12
How about parity bit error?
13
Hamming codes with additional parity
• The extra parity bit applies to all bits after
the Hamming code check bits have been
added.
• Then all single-bit, two-bit and three-bit
errors can be detected.
• two-bit errors can be distinguished from
single-bit and three-bit errors.
• Single-bit errors can be corrected.
14
Two-bit errors
Two-bit errors can at least be recognized:
• When using correction, if a parity error is detected and the
Hamming code indicates that there is an error, this error can be
corrected.
• However, if a parity error is not detected but the Hamming code
indicates that there is an error, this is assumed to have been
due to a two-bit error, which is detected but cannot be corrected.
• Hamming Codes are capable of correcting one error
or detecting two errors but not capable of doing both
simultaneously.
15
Hamming Rule
d+p+1<= 2p
16
Suitable Code
17
4 Parity Bits
• Can provide error correction for five to eleven
data bits.
19
Calculating Parity Bits
20
The Entire Code
The 8-bit data word is written into the memory together with
the 4 parity bits as a 12-bit composite word. Substituting the 4
parity bits in their proper positions, we obtain the 12-bit
composite word.
21
Checking
C=C8C4C2C1
•If C=0, there is no error has occurred.
25
Algorithm (Cont.)
• The parity bit at position 2k checks
bits in positions having bit k set in
their binary representation.
27
Additional Parity Bit (Cont.)
• This produces 0011100101001 (even
parity)
Note that this scheme will detect more than two erroneous bits in
many cases, but is not guaranteed to detect all such errors.
28