ERROR DETECTION &
CORRECTION CODES
CONTENTS:
 Introduction
 Parity bit
 Hamming code
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 1
ERROR DETECTION AND CORRECTION CODES
 When the digital information in the binary form is
transmitted from one circuit or system to another
circuit or system an error may occur.
 This means the signal corresponding to 0 may
change to 1 or vice-versa due to presence of noise
 To maintain data integrity between transmitter
and receiver, extra bit or more than one bit are
added in the data.
 These extra bits allow the detection and sometimes
the correction of error in the data.
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 2
• The data along with the extra bit /bits form the
code
• Codes which allow only error detection are called
error detecting codes and codes which allow error
detection and correction are called error
detecting and correcting codes
Parity bit
• A parity bit is used for the purpose of detecting
errors during transmission of binary information.
• A parity bit is an extra bit included with a binary
message to make the number of 1s either odd or
even.
Contd…
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 3
• The message including the parity bit is transmitted and
then checked at the receiving end for errors.
• An error is detected if the checked parity does not
correspond with the one transmitted.
• The circuit that generates the parity bit in the transmitter
is called a parity generator and the circuit that checks the
parity in the receiver is called a parity checker.
• In even parity the added parity bit will make the total
number of 1s an even amount. In odd parity the added
parity bit will make the total number of 1s an odd
amount.
• As a general rule in the digital system where the
transmission system is relatively short, it may be assumed
that probability of a single-bit error is small and that of a
double-bit error and higher order errors is extremely
small.
Contd….
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 4
 The parity error detection system just described detects any odd
number of errors.
 However, it cannot detect an even number of error because such
errors will not destroy the parity of the transmitted group of bits
Block parity:
 When several binary words are transmitted or received in
succession, the resulting collection of bits can be regarded as a
block of data, having rows and columns.
 Example: four eight bit words in succession form an 4x8 block.
 Parity bits can then be assigned to both rows and columns.
 This scheme is known as block parity
 It makes it possible to correct any single error occurring in a
data word and to detect any two errors in a word.
Contd…
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 5
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y
6
HAMMING CODE
 Hamming code not only provides the detection of a bit
error, but also identifies which bit is in error so that it can
be corrected.
 Thus hamming code is called error detecting and
correcting code.
 The code uses a number of parity bits(dependent on the
number of information bits) located at certain position in a
group.
 Number of parity bits:
 The number of parity bits depends on the number of
information bits
 If the number of bits is designated as x, then the number of
parity bits P is determined using the relation
2 𝑝
≥ 𝑥 + 𝑃 + 1
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 7
CONTD…
Location of the parity bits in a code:
• The parity bits are located in the positions that are
numbered corresponding to ascending powers of
two(1,2,4,8,….).
• Therefore, for 7-bit code, locations for parity bits and
information bits are as follows:
D4, D3,D2,P3, D1,P2,P1
Assigning values to parity bit:
• In hamming code , each parity bit provides a check on
certain other bits in the total code, therefore we must
know the value of these others in order to assign the
parity bit value.
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 8
Bit Designation D4 D3 D2 P3 D1 P2 P1
Bit Location 7 6 5 4 3 2 1
Binary Location
Number
111 110 101 100 011 010 001
Information Bits
Parity Bits
Bit Location Table:
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 9
CONTD…
Assignment of P1:
 This parity bit checks all bit locations, including itself, that
have 1s in the same location in the binary location
numbers.
Assignment of P2:
 This parity bit checks all bit locations, including itself, that
have 1s in the middle bit.
Assignment of P3:
 This parity bit checks all bit locations, including itself, that
have 1s in the left-most bit.
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 10
SINGLE ERROR CORRECTION AND DOUBLE
ERROR DETECTION
 With the light modification, it is possible to construct
hamming code for single error correction and double
error detection.
 A one more parity bit is added in the hamming code to
ensure hamming code contains an even number of
ones.
 The resulting hamming code enables single error
correction and double error detection.
 When overall parity bit is correct, there is no single
error during the transmission of the code.
 If overall parity bit is incorrect, then there is single
error and the bit position of the error can be indicated
by binary number formed after checking the parity
bits.
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 11
CONTD….
 Hence, single error correction can be
achieved.
 If overall parity bit is correct and binary
number formed after checking the parity bits
is other than 0-0-0, there are two errors.
 In this case, double error detection is
achieved.
 However, no correction is possible.
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 12
Conclusion:
The various types of error detecting and correcting methods are discussed
in brief manner.
References:
• Mandal, “Digital Electronics Principles & Application, McGraw Hill
Edu, 2013.
• William Keitz, Digital Electronics-A Practical Approach with VHDL,
Pearson, 2013.
• Thomas L.Floyd, ‘Digital Fundamentals’, 11th edition, Pearson
Education, 2015.
• Charles H.Roth, Jr, Lizy Lizy Kurian John, ‘Digital System Design
using VHDL, Cengage,2013.
• D.P.Kothari,J.S.Dhillon, ‘Digital circuits and Design’,Pearson
Education, 2016.
• A.P.Godse., Dr.D.A.Godse, ‘Digital Logic Circuits’ , Technical
Publications Third Edition 2016
• Other Web Sources
K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 13

Error detection & correction codes

  • 1.
    ERROR DETECTION & CORRECTIONCODES CONTENTS:  Introduction  Parity bit  Hamming code K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 1
  • 2.
    ERROR DETECTION ANDCORRECTION CODES  When the digital information in the binary form is transmitted from one circuit or system to another circuit or system an error may occur.  This means the signal corresponding to 0 may change to 1 or vice-versa due to presence of noise  To maintain data integrity between transmitter and receiver, extra bit or more than one bit are added in the data.  These extra bits allow the detection and sometimes the correction of error in the data. K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 2
  • 3.
    • The dataalong with the extra bit /bits form the code • Codes which allow only error detection are called error detecting codes and codes which allow error detection and correction are called error detecting and correcting codes Parity bit • A parity bit is used for the purpose of detecting errors during transmission of binary information. • A parity bit is an extra bit included with a binary message to make the number of 1s either odd or even. Contd… K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 3
  • 4.
    • The messageincluding the parity bit is transmitted and then checked at the receiving end for errors. • An error is detected if the checked parity does not correspond with the one transmitted. • The circuit that generates the parity bit in the transmitter is called a parity generator and the circuit that checks the parity in the receiver is called a parity checker. • In even parity the added parity bit will make the total number of 1s an even amount. In odd parity the added parity bit will make the total number of 1s an odd amount. • As a general rule in the digital system where the transmission system is relatively short, it may be assumed that probability of a single-bit error is small and that of a double-bit error and higher order errors is extremely small. Contd…. K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 4
  • 5.
     The parityerror detection system just described detects any odd number of errors.  However, it cannot detect an even number of error because such errors will not destroy the parity of the transmitted group of bits Block parity:  When several binary words are transmitted or received in succession, the resulting collection of bits can be regarded as a block of data, having rows and columns.  Example: four eight bit words in succession form an 4x8 block.  Parity bits can then be assigned to both rows and columns.  This scheme is known as block parity  It makes it possible to correct any single error occurring in a data word and to detect any two errors in a word. Contd… K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 5
  • 6.
    K O NG U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 6
  • 7.
    HAMMING CODE  Hammingcode not only provides the detection of a bit error, but also identifies which bit is in error so that it can be corrected.  Thus hamming code is called error detecting and correcting code.  The code uses a number of parity bits(dependent on the number of information bits) located at certain position in a group.  Number of parity bits:  The number of parity bits depends on the number of information bits  If the number of bits is designated as x, then the number of parity bits P is determined using the relation 2 𝑝 ≥ 𝑥 + 𝑃 + 1 K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 7
  • 8.
    CONTD… Location of theparity bits in a code: • The parity bits are located in the positions that are numbered corresponding to ascending powers of two(1,2,4,8,….). • Therefore, for 7-bit code, locations for parity bits and information bits are as follows: D4, D3,D2,P3, D1,P2,P1 Assigning values to parity bit: • In hamming code , each parity bit provides a check on certain other bits in the total code, therefore we must know the value of these others in order to assign the parity bit value. K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 8
  • 9.
    Bit Designation D4D3 D2 P3 D1 P2 P1 Bit Location 7 6 5 4 3 2 1 Binary Location Number 111 110 101 100 011 010 001 Information Bits Parity Bits Bit Location Table: K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 9
  • 10.
    CONTD… Assignment of P1: This parity bit checks all bit locations, including itself, that have 1s in the same location in the binary location numbers. Assignment of P2:  This parity bit checks all bit locations, including itself, that have 1s in the middle bit. Assignment of P3:  This parity bit checks all bit locations, including itself, that have 1s in the left-most bit. K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 10
  • 11.
    SINGLE ERROR CORRECTIONAND DOUBLE ERROR DETECTION  With the light modification, it is possible to construct hamming code for single error correction and double error detection.  A one more parity bit is added in the hamming code to ensure hamming code contains an even number of ones.  The resulting hamming code enables single error correction and double error detection.  When overall parity bit is correct, there is no single error during the transmission of the code.  If overall parity bit is incorrect, then there is single error and the bit position of the error can be indicated by binary number formed after checking the parity bits. K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 11
  • 12.
    CONTD….  Hence, singleerror correction can be achieved.  If overall parity bit is correct and binary number formed after checking the parity bits is other than 0-0-0, there are two errors.  In this case, double error detection is achieved.  However, no correction is possible. K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 12
  • 13.
    Conclusion: The various typesof error detecting and correcting methods are discussed in brief manner. References: • Mandal, “Digital Electronics Principles & Application, McGraw Hill Edu, 2013. • William Keitz, Digital Electronics-A Practical Approach with VHDL, Pearson, 2013. • Thomas L.Floyd, ‘Digital Fundamentals’, 11th edition, Pearson Education, 2015. • Charles H.Roth, Jr, Lizy Lizy Kurian John, ‘Digital System Design using VHDL, Cengage,2013. • D.P.Kothari,J.S.Dhillon, ‘Digital circuits and Design’,Pearson Education, 2016. • A.P.Godse., Dr.D.A.Godse, ‘Digital Logic Circuits’ , Technical Publications Third Edition 2016 • Other Web Sources K O N G U N A D U C O L L E G E O F E N G I N E E R I N G & T E C H N O L O G Y 13