SlideShare a Scribd company logo
Error Detection And Correction
1
• 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.
Parity Bit
2
• 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.
Parity Bit Example
With Even Parity With Odd
Parity
• 1000001
7 bits
01000001
8 bits
11000001
• 1010100 11010100 01010100
3
Characteristics of Parity
4
• Even parity is more common
• Parity may be used with binary numbers
as well as with codes including ASCII
• The parity bit may be placed in any fixed
position in the code
Parity Bit Generating and
Checking
5
• An even parity bit is generated at the sending end for
all 7-bit ASCII characters
• The 8-bit characters including the parity bits are
transmitted to their destination
• The parity of each character is then checked at the
receiving end
• If the parity of the received character is not even
(assuming even parity is used), at least one bit has
changed its value during the transmission
Pros & Cons
6
• If the number of bits changed is even, the error
will not be detected.
• It can only detects one, three, or any odd
number of errors in each character.
• Parity does not indicate which bit contained
the error, even when it can detect it.
• The data must be discarded entirely, and re-
transmitted from scratch.
• It uses only a single bit, resulting in the
least overhead.
Hamming Codes
7
• The most common types of error-correcting codes
used in RAM are based on the codes devised by R.W.
Hamming.
• K parity bits are added to an n-bit data word,
forming a new word of n + k bits.
• The bit positions are numbered in sequence from 1
to
n + k.
• Those positions numbered with powers of two are
reserved for the parity bits.
• The code can be used with words of any length.
(11,7) Hamming Code Example
7-bit data word "0110101“ ( d - data bits, p - parity
bits )
8
10
Hamming Code Example
(Cont.)
PAL is a registered trademark of Lattice Semiconductor Corp.
• Assume the final bit gets corrupted and turned from 1
to 0
• Flag each parity bit as 1 when the even parity check
fails
Hamming Code Example (Cont.)
• Evaluate the value of the parity bits.
•The integer value of the parity bits is 11, signifying
that the 11th bit in the data word (including parity bits)
is wrong and needs to be flipped.
10
Hamming Code Example
(Cont.)
11
• Flipping the 11th bit gives changes
10001100100 back into
10001100101.
• Removing the Hamming codes gives
the original data word of 0110101.
How about parity bit error?
12
As parity bits do not check each other, if
a single parity bit check fails and all
others succeed, then it is the parity bit
in question that is wrong and not any
bit it checks.
Hamming codes with additional
parity
13
• 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.
Two-bit errors
14
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.
Hamming Rule
15
d + p + 1 < = 2p
Where d is the number of data bits and p is the
number of parity bits
Suitable Code
16
• From the practical standpoint of
communications, a (11,7) code is not a good
choice, because it involves non-standard
character lengths.
• Designing a suitable code requires that the ratio
of parity to data bits and the processing time
involved to encode and decode the data stream
be minimized.
• A code that efficiently handles 8-bit data
items is desirable.
4 Parity Bits
17
• Can provide error correction for five to
eleven data bits.
• A (12,8) code then offers a
reasonable compromise in the bit
stream .
Why (12,8) code is desirable ?
The code enables data link packets to be
constructed easily by permitting one parity
byte to serve two data bytes.
Another Example
(12,8)
Assume a 8-bit data word 11000100. We include
4 parity bits with this word and arranged the 12
bits as above. Please compute each parity bit
value:
18
Calculating Parity Bits
• We’re using Even
Parity.
19
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.
20
Checking
• When the 12 bits are read from memory, they
are checked again for errors
• The parity of the word is checked over the same
groups of bits, including their parity bits
21
How to locate the error bit?
22
C=C8C4C2C1
•If C=0, there is no error has
occurred.
•If C!=0, the 4-bit binary number
formed by the check bits gives the
position of the erroneous bit if
only a single bit is in error.
Three Cases
The error can then be corrected by complementing the
corresponding bit. An error can occur in the data or in one of the
parity bits. 23
Algorithm for General
Hamming
24
• All bit positions that are powers of two are used as parity bits. (positions 1, 2,
4, 8, 16, 32, 64, etc.)
• All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9,
10,
11, 12, 13, 14, 15, 17, etc.)
• Each parity bit calculates the parity for some of the bits in the code word. The
position of the parity bit determines the sequence of bits that it alternately
checks and skips.
– Position 1 (n=1): skip 0 bit (0=n-1), check 1 bit (n), skip 1 bit (n), check 1 bit (n), skip
1 bit (n), etc.
– Position 2 (n=2): skip 1 bit (1=n-1), check 2 bits (n), skip 2 bits (n), check 2 bits (n),
skip 2 bits (n), etc.
– Position 4 (n=4): skip 3 bits (3=n-1), check 4 bits (n), skip 4 bits (n), check 4 bits
(n), skip 4 bits (n), etc.
– Position 8 (n=8): skip 7 bits (7=n-1), check 8 bits (n), skip 8 bits (n), check 8 bits
(n), skip 8 bits (n), etc.
– Position 16 (n=16): skip 15 bits (15=n-1), check 16 bits (n), skip 16 bits (n), check
16 bits (n), skip 16 bits (n), etc.
– Position 32 (n=32): skip 31 bits (31=n-1), check 32 bits (n), skip 32 bits (n), check
32 bits (n), skip 32 bits (n), etc.
– General rule for position n: skip n-1 bits, check n bits, skip n bits, check n bits...
– And so on.
Algorithm (Cont.)
25
• The parity bit at position 2k
checks bits in positions having
bit k set in their binary
representation.
• For instance, bit 13, i.e. 1101(2), is
checked by bits 1000(2) = 8,
0100(2)=4
Additional Parity Bit
26
• By adding another parity bit to the
coded word, the Hamming code can
be used to correct a single error and
detect double errors.
• Appending P13 to the previous 12-bit
coded word becomes
001110010100P13, where P13 is
evaluated from the XOR of the other
12 bits.
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.
27

More Related Content

PPTX
Error Correcting and Error Detecting Codes.pptx
PPT
Error detection and correction codes
PPTX
5.Error correction-Hamming Code.pptx
PPT
Error detection and correction codes r006
PDF
Error detection & correction codes
PPTX
UNIT-V.pptx
PDF
IRJET- FPGA Implementation of Orthogonal Codes for Efficient Digital Communic...
PPTX
Error detection and correction of computer network
Error Correcting and Error Detecting Codes.pptx
Error detection and correction codes
5.Error correction-Hamming Code.pptx
Error detection and correction codes r006
Error detection & correction codes
UNIT-V.pptx
IRJET- FPGA Implementation of Orthogonal Codes for Efficient Digital Communic...
Error detection and correction of computer network

Similar to Lecture7.pptxhfjgjgjghcgzgzfzfzvzgxhchchc (20)

PPTX
PPTX
Digital logic designing presentation
PPTX
Digital Communication GRP1 (1).pptx
PPTX
10-Error Detection-Kode Hamming.pptx
PDF
Binary_Codes.pdfhfkhvfkdhvbhfvfdhfgffhfdhyf
PDF
Bitwise Operations(1).pdf
PPTX
Digital Logic BCA TU Chapter 2.2
PPTX
Error Detection N Correction
PDF
K034066071
PPTX
docker docker docker docker docker docker docker docker docker docker docker ...
PPT
Lecture 22
PPTX
Parity check(Error Detecting Codes)
PPTX
linear block code.pptxjdkdidjdjdkdkidndndjdj
PDF
Chapter 9.pdf
PPTX
PPTX
Digital electronica RSS vvvdmsASmCMmmmmmcdsdvfssc
PPTX
unit 1 introudction of the file and sepm
PPTX
Error detection methods-computer networks
DOCX
Manoch1raw 160512091436
DOCX
Error dectation and correction
Digital logic designing presentation
Digital Communication GRP1 (1).pptx
10-Error Detection-Kode Hamming.pptx
Binary_Codes.pdfhfkhvfkdhvbhfvfdhfgffhfdhyf
Bitwise Operations(1).pdf
Digital Logic BCA TU Chapter 2.2
Error Detection N Correction
K034066071
docker docker docker docker docker docker docker docker docker docker docker ...
Lecture 22
Parity check(Error Detecting Codes)
linear block code.pptxjdkdidjdjdkdkidndndjdj
Chapter 9.pdf
Digital electronica RSS vvvdmsASmCMmmmmmcdsdvfssc
unit 1 introudction of the file and sepm
Error detection methods-computer networks
Manoch1raw 160512091436
Error dectation and correction
Ad

More from rani marri (20)

PPTX
RESTful Web Services.pptxbnbjmgbjbvvhvhj
PPT
ch11 jrtrtgrrhwddewwfetbbfdrhwefegtrhgtgr
PPTX
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
PPTX
NagiOs.pptxhjkgfddssddfccgghuikjhgvccvvhjj
PPTX
git.ppt.pptx power point presentation got Google internet
PPT
EJB.ppthckhkhohjpfuysfzhxjvkgur6eydgdcjjggjj
PPTX
Containers Orchestration using kubernates.pptx
PPTX
JSP.pptx programming guide for beginners and experts
PPT
CSC128_Part_1_WrapperClassesAndStrings_CenBNcj.ppt
PPT
nodejs tutorial foor free download from academia
PPTX
NAAC PPT M.B.A.pptx
PPTX
must.pptx
PPTX
node.js.pptx
PPTX
oops with java modules iii & iv.pptx
PPT
oops with java modules i & ii.ppt
PPTX
software engineering modules iii & iv.pptx
PPTX
software engineering module i & ii.pptx
PPT
ADVANCED JAVA MODULE III & IV.ppt
PPT
ADVANCED JAVA MODULE I & II.ppt
PPTX
data structures module III & IV.pptx
RESTful Web Services.pptxbnbjmgbjbvvhvhj
ch11 jrtrtgrrhwddewwfetbbfdrhwefegtrhgtgr
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
NagiOs.pptxhjkgfddssddfccgghuikjhgvccvvhjj
git.ppt.pptx power point presentation got Google internet
EJB.ppthckhkhohjpfuysfzhxjvkgur6eydgdcjjggjj
Containers Orchestration using kubernates.pptx
JSP.pptx programming guide for beginners and experts
CSC128_Part_1_WrapperClassesAndStrings_CenBNcj.ppt
nodejs tutorial foor free download from academia
NAAC PPT M.B.A.pptx
must.pptx
node.js.pptx
oops with java modules iii & iv.pptx
oops with java modules i & ii.ppt
software engineering modules iii & iv.pptx
software engineering module i & ii.pptx
ADVANCED JAVA MODULE III & IV.ppt
ADVANCED JAVA MODULE I & II.ppt
data structures module III & IV.pptx
Ad

Recently uploaded (20)

PPTX
great itemsgreat itemsgreat itemsgreat items.pptx
PPTX
executive branch_no record.pptxsvvsgsggs
PPTX
Countable and uncountable nouns_SERPA YORDY.pptx
PPTX
Mobile-Device-Management-MDM-Architecture.pptx
PDF
Colorful Illustrative Digital Education For Children Presentation.pdf
PPTX
VERB TO BE_SERPA YORDY.pptxvhyjjkjjjjjjuuj
PPTX
2.Important-Definihhhhhhtions18 (1).pptx
PDF
Lifting Equipment Inspection Checklist with eAuditor Audits & Inspections
PPTX
Query and optimizing operating system.pptx
PDF
Core Components of IoT, The elements need for IOT
PDF
YKS Chrome Plated Brass Safety Valve Product Catalogue
PPTX
Sem-8 project ppt fortvfvmat uyyjhuj.pptx
PPTX
Drone.pptx this is the word like a good time to come over and watch the kids
PDF
Chapter -24-By Dr Sajid Ali Ansari 2021.pdf
PPTX
Final Draft Presentation for dtaa and direct tax
PDF
DOC-20250802-WA0013._20250802_161719_0000.pdf
PPTX
Chapter III - ppt system admin and .pptx
PPTX
udi-benefits-ggggggggfor-healthcare.pptx
PDF
Top 10 Client Success Story_ The Buy Snapchat Account Experience.pdf
PPTX
Generation of Computers.pptx kkkkkkkkkkkk
great itemsgreat itemsgreat itemsgreat items.pptx
executive branch_no record.pptxsvvsgsggs
Countable and uncountable nouns_SERPA YORDY.pptx
Mobile-Device-Management-MDM-Architecture.pptx
Colorful Illustrative Digital Education For Children Presentation.pdf
VERB TO BE_SERPA YORDY.pptxvhyjjkjjjjjjuuj
2.Important-Definihhhhhhtions18 (1).pptx
Lifting Equipment Inspection Checklist with eAuditor Audits & Inspections
Query and optimizing operating system.pptx
Core Components of IoT, The elements need for IOT
YKS Chrome Plated Brass Safety Valve Product Catalogue
Sem-8 project ppt fortvfvmat uyyjhuj.pptx
Drone.pptx this is the word like a good time to come over and watch the kids
Chapter -24-By Dr Sajid Ali Ansari 2021.pdf
Final Draft Presentation for dtaa and direct tax
DOC-20250802-WA0013._20250802_161719_0000.pdf
Chapter III - ppt system admin and .pptx
udi-benefits-ggggggggfor-healthcare.pptx
Top 10 Client Success Story_ The Buy Snapchat Account Experience.pdf
Generation of Computers.pptx kkkkkkkkkkkk

Lecture7.pptxhfjgjgjghcgzgzfzfzvzgxhchchc

  • 1. Error Detection And Correction 1 • 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 2 • 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 With Even Parity With Odd Parity • 1000001 7 bits 01000001 8 bits 11000001 • 1010100 11010100 01010100 3
  • 4. Characteristics of Parity 4 • Even parity is more common • Parity may be used with binary numbers as well as with codes including ASCII • The parity bit may be placed in any fixed position in the code
  • 5. Parity Bit Generating and Checking 5 • An even parity bit is generated at the sending end for all 7-bit ASCII characters • The 8-bit characters including the parity bits are transmitted to their destination • The parity of each character is then checked at the receiving end • If the parity of the received character is not even (assuming even parity is used), at least one bit has changed its value during the transmission
  • 6. Pros & Cons 6 • If the number of bits changed is even, the error will not be detected. • It can only detects one, three, or any odd number of errors in each character. • Parity does not indicate which bit contained the error, even when it can detect it. • The data must be discarded entirely, and re- transmitted from scratch. • It uses only a single bit, resulting in the least overhead.
  • 7. Hamming Codes 7 • The most common types of error-correcting codes used in RAM are based on the codes devised by R.W. Hamming. • K parity bits are added to an n-bit data word, forming a new word of n + k bits. • The bit positions are numbered in sequence from 1 to n + k. • Those positions numbered with powers of two are reserved for the parity bits. • The code can be used with words of any length.
  • 8. (11,7) Hamming Code Example 7-bit data word "0110101“ ( d - data bits, p - parity bits ) 8
  • 9. 10 Hamming Code Example (Cont.) PAL is a registered trademark of Lattice Semiconductor Corp. • Assume the final bit gets corrupted and turned from 1 to 0 • Flag each parity bit as 1 when the even parity check fails
  • 10. Hamming Code Example (Cont.) • Evaluate the value of the parity bits. •The integer value of the parity bits is 11, signifying that the 11th bit in the data word (including parity bits) is wrong and needs to be flipped. 10
  • 11. Hamming Code Example (Cont.) 11 • Flipping the 11th bit gives changes 10001100100 back into 10001100101. • Removing the Hamming codes gives the original data word of 0110101.
  • 12. How about parity bit error? 12 As parity bits do not check each other, if a single parity bit check fails and all others succeed, then it is the parity bit in question that is wrong and not any bit it checks.
  • 13. Hamming codes with additional parity 13 • 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 14 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 15 d + p + 1 < = 2p Where d is the number of data bits and p is the number of parity bits
  • 16. Suitable Code 16 • From the practical standpoint of communications, a (11,7) code is not a good choice, because it involves non-standard character lengths. • Designing a suitable code requires that the ratio of parity to data bits and the processing time involved to encode and decode the data stream be minimized. • A code that efficiently handles 8-bit data items is desirable.
  • 17. 4 Parity Bits 17 • Can provide error correction for five to eleven data bits. • A (12,8) code then offers a reasonable compromise in the bit stream . Why (12,8) code is desirable ? The code enables data link packets to be constructed easily by permitting one parity byte to serve two data bytes.
  • 18. Another Example (12,8) Assume a 8-bit data word 11000100. We include 4 parity bits with this word and arranged the 12 bits as above. Please compute each parity bit value: 18
  • 19. Calculating Parity Bits • We’re using Even Parity. 19
  • 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. 20
  • 21. Checking • When the 12 bits are read from memory, they are checked again for errors • The parity of the word is checked over the same groups of bits, including their parity bits 21
  • 22. How to locate the error bit? 22 C=C8C4C2C1 •If C=0, there is no error has occurred. •If C!=0, the 4-bit binary number formed by the check bits gives the position of the erroneous bit if only a single bit is in error.
  • 23. Three Cases The error can then be corrected by complementing the corresponding bit. An error can occur in the data or in one of the parity bits. 23
  • 24. Algorithm for General Hamming 24 • All bit positions that are powers of two are used as parity bits. (positions 1, 2, 4, 8, 16, 32, 64, etc.) • All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc.) • Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit determines the sequence of bits that it alternately checks and skips. – Position 1 (n=1): skip 0 bit (0=n-1), check 1 bit (n), skip 1 bit (n), check 1 bit (n), skip 1 bit (n), etc. – Position 2 (n=2): skip 1 bit (1=n-1), check 2 bits (n), skip 2 bits (n), check 2 bits (n), skip 2 bits (n), etc. – Position 4 (n=4): skip 3 bits (3=n-1), check 4 bits (n), skip 4 bits (n), check 4 bits (n), skip 4 bits (n), etc. – Position 8 (n=8): skip 7 bits (7=n-1), check 8 bits (n), skip 8 bits (n), check 8 bits (n), skip 8 bits (n), etc. – Position 16 (n=16): skip 15 bits (15=n-1), check 16 bits (n), skip 16 bits (n), check 16 bits (n), skip 16 bits (n), etc. – Position 32 (n=32): skip 31 bits (31=n-1), check 32 bits (n), skip 32 bits (n), check 32 bits (n), skip 32 bits (n), etc. – General rule for position n: skip n-1 bits, check n bits, skip n bits, check n bits... – And so on.
  • 25. Algorithm (Cont.) 25 • The parity bit at position 2k checks bits in positions having bit k set in their binary representation. • For instance, bit 13, i.e. 1101(2), is checked by bits 1000(2) = 8, 0100(2)=4
  • 26. Additional Parity Bit 26 • By adding another parity bit to the coded word, the Hamming code can be used to correct a single error and detect double errors. • Appending P13 to the previous 12-bit coded word becomes 001110010100P13, where P13 is evaluated from the XOR of the other 12 bits.
  • 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. 27