0% found this document useful (0 votes)
84 views10 pages

2020-2hamming Code

Uploaded by

Prabhakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views10 pages

2020-2hamming Code

Uploaded by

Prabhakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

COPY RIGHT

2020 IJIEMR.Personal use of this material is permitted. Permission from IJIEMR must

be obtained for all other uses, in any current or future media, including
reprinting/republishing this material for advertising or promotional purposes, creating new
collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted
component of this work in other works. No Reprint should be done to this paper, all copy
right is authenticated to Paper Authors
IJIEMR Transactions, online available on 24th Mar 2020. Link
:http://www.ijiemr.org/downloads.php?vol=Volume-09&issue=ISSUE-03
Title: HAMMING CODE FOR SINGLE BIT ERROR DETECTION & ERROR CORRECTION

Volume 09, Issue 03, Pages: 101-109.


Paper Authors
TELAGARAPU.PRABHAKAR, M.NARASIMHARAO

USE THIS BARCODE TO ACCESS YOUR ONLINE PAPER

To Secure Your Paper As Per UGC Guidelines We Are Providing A Electronic


Bar Code

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 www.ijiemr.org


HAMMING CODE FOR SINGLE BIT ERROR DETECTION & ERROR
CORRECTION
TELAGARAPU.PRABHAKAR1, M.NARASIMHARAO2
1,2
Dept of ECE, GMR Institute of Technology , Rajam -532127 , Andhra Pradesh, India.

Abstract—Error free transmission is a major issue in present Electronic devices. Fixed data transmission
from sender to receiver occurs with greater issue, i.e. errors in information of data transmission from transmitter
to receiver. Here Error correction codes and detect codes are used to protect the information In memories and
logic registers in electronic circuits. Hamming codes are one of the best error correcting code using either, even
parity or odd parity check method. In this paper Hamming code algorithm is used for Error detection and Error
rectification. The Hamming codes will be used to detect and correct the one bit error. ( A eleven bit message
and four bit parity is used to form a 15-bit code word. Then this 15-bit code word is received at the receiver. If
it is having one bit error it will be detected and corrected to get the original message code word. If the received
information is having a single error , this hamming code detects the presence of a single error in the input code
word). This process implemented in cadence tool.
Index Terms—Hamming codes, Error detection, Error correction, Cadence tool

1 INTRODUCTION
In Digital communication systems and the electronic detection codes and are used to detect an error
devices errors are introduced during the transmission occurred during TX of the message. A simple example
of data from sender to receiver. The input data from of error detection code is parity check method and
sender to receiver due to interference or noise. The both codes are error detection and error rectification
error of fault is occurring circumstance when the also called error recognition
output information does not correspond with the input and correction codes. In error rectification codes,
information that means “0” bit invert to “1” or “1” bit parity check has a childlike mode to detect error
invert to “0” Error change one to zero value (0 to 1). location bits.At one time the corrupted bit is located,
To improve the reliability and stability it is At one time the corrupted bit is present, its value is a
indispensable to find and even off the mistake. Hence, range (from 0 to 1 or 1 to 0) [2]. There
we have to employ some kind. Error detection and are dissimilar cases of error controlling codes such as
Error rectification codes. This type of codes, one or parity checking, checksum error detection, CRC.
two than one other number is appended to bits at the Comparing with other error identification codes,
time of sending the information [1] to be amended. To hamming code is one of the best methods for error
improve the reliability, it detection as well as error rectification. at the location
is indispensable to find and even off the mistake. of bits first bit is (1,3,5,7,9,…..), second bit is
Hence, we have to employ some kind. Error (2,3,6,7,10,11,….) and each bits calculated as per
perception and error rectification codes. The data bits same first and second bit parallel to third and fourth
along with the parity bit forms a code word. Codes bit values.
Which allow only error detection are called Error

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 101


2 PROCEDURE FOR HAMMING CODE Tx to Rx. data sending bit by bit, Ex Tx
2.1 Hamming Codes “01101111110” to Rx”01101111100” here one bit
position occurs one error so input of the system is
Hamming code not just provides the detection of a
corrupted. This type of problem solves the different
bit error, but also identifies detect a double bit error.
type of solutions, but the hamming code is one of the
The number of numbers assigned as ‘m’ then the
best and efficient error code. And also Hamming code
number of parity bits ’P’ is determined by the
used to burst errors(4bit burst error) double bit error
following relationship
detection and rectification.
2P ≥ P + m + 1 2.2 PARITY BIT IDENTIFICATION PROCESS
Here m= number of message bits. The parity bit recognition method using either, even
P= parity bits. parity or odd parity checker method, the parity bit
position calculating power of 2 i.e. 20, 21 22 .…2n .
Eleven information bits, m=11, then the number of
The position of parity bits are P1,P2,P3,P4…..PN. Bit
parity bits ‘P’ is obtained by trial and error using the
identity 1 bit checker is P1 and similarly the parity
above equation. Thus 4 parity bits are required for 11
bits P2,P3,P4….PN, the 2bit checker is P2, 4bit
information bits and these 4 parity bits are placed on
checker is P3 and 8 bit checker is P4.
the powers of 2. Like 20, 21, 22, 23, 24………[1].
Hamming code is one best efficiency for error 1.Parity bit1, check 1bit, skip 1 bit (P1, 0 , 0 ,1 ,0, 1, 0
detection as well as for error rectification and this ,1 = 1) The number of ‘1’ is odd value is ‘1’
code is likewise comfortable to implement. Fast-speed 2.Parity bit2, check 2bit, skip 2bit (P2, 0, 1,1, 0, 1, 1, 0
information transmission and high reliability becomes = 0)
the two most important criteria in modern The number of ‘1’is even value is ‘0’
communication systems, speed of input data by 3.Parity bit3, check 4bit, skip 4bit (P3, 0, 1, 1, 1, 1, 0,
the recipient, that is channel coding. Apparently, the 1 = 1)
two positions are at odds. Hamming code error The number of ‘1’ is odd value is ‘1’
perception and rectification with the odd &even parity 4.Parity bit4, check 8bit, skip 8bit (P4, 0, 0, 1, 1, 0, 1,
method using Xilinx and Cadence Tool is a technique 1 = 0)
to determine the fault fix and that error . In this system The number of ‘1’is even value is ‘0’[1].
information transmission of data from sender to
receiver. Here to send 15 bit data from input to output, Single Error Detection and Error rectification and
studied in details in the transmission section, data out Single bit error detection (SER/SED) codes are
means 15 bit encrypted output data is sent from sender experimentally used in cache memories and in main
to receiver. In transmission section and at receiver memory systems in information processing systems.
section, input means 15 bit data is picked up by the The general algorithm for the hamming code is as
receiver. Different type of hamming codes like follows:
(7,4),(15,11),(31,26),(63,57),(127,120),(255,247) 1The parity bits added the given input data depend
In communication systems. These codes are on message bits i.e. p+m
communication error, i.e. from input dataTx 2. Next, the parity bits location placed in given data
(transmitter) to Rx (receiver) major issues formed. 3. These positions are numbered in powers of 2 for the
Sender to receiver data is corrupted, i.e. binary bit data parity bits and the remaining bits are data bits.

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 102


4. Parity bits are calculated by logic gate operation, 2.4 PARITY BIT IDENTIFICATION IN 15 BIT
i.e. EXOR Operation. The parity bits are calculated DATA
as follows: An Input of 11-message bits, parity bits process
Input 11 message bits “01101111110” the parity
P1 = EX-OR of bit positions (1, 3, 5, 7, 9, 11, 13,15). bits become by formula,
P2 = EX-OR of bit positions (2, 3, 6, 7, 10, 11,14,15).
2P ≥ P + m + 1
P3 = EX-OR of bit positions (4, 5, 6, 7, 12,13,14,15). m=11 p=4
P4 = EX-OR of bit position (8, 9, 10, 11, 12, n=m+p , n=7
13,14,15). n=15 therefore input data is 15- bit data
Here m= message bits. P= parity bits.
Calculate the parity bits with EXOR Operation
CHECK THE PARITY BITS:

Here EXOR use bit wise operator, i.e. “^” 1.Parity bit1, check 1bit, skip 1 bit (P1, 0 , 0 ,1 ,1, 1, 1
P1= d1^ d2 ^ d4 ^ d 5 ^ d 7 ^ d 9 ^ d11. ,1 = 1) The number of ‘1’ is odd value is ‘1’
P2= d1 ^ d3 ^ d4 ^ d 6 ^ d 7 ^ d 10 ^ d11. 2.Parity bit2, check 2bit, skip 2bit (P2, 0, 1,1, 1, 1, 1, 0
P3= d2 ^ d3 ^ d4 ^ d8 ^ d 9 ^ d 10 ^ d11. = 1)
P4= d5 ^ d6 ^ d7 ^ d8 ^ d 9 ^ d 10^ d11. The number of ‘1’is odd value is ‘1’
2.3 Figures 3.Parity bit3, check 4bit, skip 4bit (P3, 0, 1, 1, 1, 1, 0,
The parity bits location table 1 = 1)
The number of ‘1’ is odd value is ‘1’
4.Parity bit4, check 8bit, skip 8bit (P4, 0, 1, 1, 1, 0, 1,
Parity Input Message Total data
1 = 1)
data(n) bit(m) p=(n,m)
Bits(p) The number of ‘1’is odd value is ‘1’.

2 3 1 (3,1) The general algorithm for the hamming code is as


follows:
3 7 4 (7,4)
Parity bits are calculated by logic gate operation, i.e.
4 15 11 (15,11) EXOR Operation. The parity bits are calculated as
follows:
5 31 26 (31,26)
P1 = EX-OR of bit positions (1, 3, 5, 7, 9, 11, 13,15).
6 63 57 (63,57)
P2 = EX-OR of bit positions (2, 3, 6, 7, 10, 11,14,15).
7 127 120 (127,120)
P3 = EX-OR of bit positions (4, 5, 6, 7, 12,13,14,15).
8 255 247 (255,247)
P4 = EX-OR of bit position (8, 9, 10, 11, 12,
13,14,15).
Table 1 Hamming code for parity bits Calculate the parity bits with EX-OR Operation
location table. Here EXOR use bit wise operator, i.e. “^”
The above fig shows how many parity bits possible
given input data or message bits P1= d1^ d2 ^ d4 ^ d 5 ^ d 7 ^ d 9 ^ d11.

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 103


P2= d1 ^ d3 ^ d4 ^ d 6 ^ d 7 ^ d 10 ^ d11. So input I.e. 11 bits are message bits and four bits
P3= d2 ^ d3 ^ d4 ^ d8 ^ d 9 ^ d 10 ^ d11. parity bits get 15 bits
P4= d5 ^ d6 ^ d7 ^ d8 ^ d 9 ^ d 10^ d11. n=p+m n= 11+4 n=15
So now calculate input of 15-bit data The bit position of parity bits 1,2,4,8 position place the
P1=1,P2=1,P3=1,P4=1 and input of message bits
P1 = EX-OR of bit positions (1,3,5,7,9,11,13,15) (1bit
d1=0,d2=1,d3=1,d4=1, d5=1, d6=1, d7=1, d8=0,
skip)
d9=1, d10=1, d11=0. Place the input data. Both parity
P2 = EX-OR of bit positions (2,3,6,7,10,11,14,15) bits and message bits adding get the 15 bit data
(2bit skip) So Finally get the 15 bit code word
P3 = EX-OR of bit positions (4,5,6,7,12,13,14,15) is”011011111111011” Input 11bit data is detected
(4bit skip) from sender data. Detect 4bit parity bits and these 4
parity bit positions of P4,P3,P2,P1 value like “1111”
P4 = EX-ORof bit position
binary bit value the 4 bit parity bits binary bit value
(8,9,10,11,12,13,14,15)(8bit skip)
remove get the input of 15- bit data.
Parity bits calculation given input code word location
3 DETECTION OF ONE ERROR BIT IN 15-BIT
of binary bits, then values of parity bits P1,P2,P3,P4.
DATA
Here using with EX-OR Operation then find parity
bits. 3.1 Input of 15 bit data
As Given 15 bit data n=M+P ,n=11+4 n=15.
Parity bit1, check 1bit, skip 1 bit (P1, 0 , 0 ,1 ,1, 1, 1 ,1 Given 15 bit code word is ”011011111111011”
= 1) The number of ‘1’ is odd value is ‘1’ The error value of 15bit data ”011011111101011”
Parity bit2, check 2bit, skip 2bit (P2, 0, 1,1, 1, 1, 1, 0 value of input code word one position value changes
= 1) from 0 to 1. What position error occurs during input
The number of ‘1’is odd value is ‘1’ 15bit data, Now calculate the 4 bit redundancy value
Parity bit3, check 4bit, skip 4bit (P3, 0, 1, 1, 1, 1, 0, 1 get the location of error value [2].
= 1) .
The number of ‘1’ is odd value is ‘1’ 3.2 DETECTION OF ONE ERROR VALUE
Parity bit4, check 8bit, skip 8bit (P4, 0, 1, 1, 1, 0, 1, 1 HAMMING CODE WITH15-BIT
= 1) INFORMATION SIGNAL AND 11-MESSAGE
The number of ‘1’is odd value is ‘1’. BITS
Input 11 message bits data is detected from
So finally get the 4 parity bits
15bit data. Detect 4bit redundancy bits and these
Table 2. parity bits table 4 redundancies bit positions of error value like
“0101” binary bit value the 4 bit redundancy
binary

An So finally get the 15-bit data is


“011011111111011”

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 104


bit value remove get the output of 11bit data[3]. The All 1’s are odd numbers value is ‘1’ and even
message ‘m’ bits are getting the input using even or numbers are ‘0’ so value of R1 is ‘0’ (all 1’s are
odd parity check method in hamming code of n bits. odd numbers value is ‘1’)
These operation problem solve the redundant bits ‘R‘ The value of R3=1
calculation. Hamming data are formed by adding the
evidence and redundant bits, i.e. n= m+r are. R4= XOR (1,0,1,1,1,1,1,0)
Redundancies bit is calculated by the formula [3]. All 1’s are odd numbers value is ‘1’ and even
numbers are ‘0’ so the value of R2 is ‘0’ (all 1’s
2r =m+ r+ 1
are even number's value is ‘0’ )
Here r= redundant bits. m=data length. n=code word
The value of R4=0
length.
So finally get the redundancy value bits
Here are using the EX-OR operation to find the The value of”0101” is 5th in binary value
redundancy bit error position,
R1= P1 ^ M1 ^ M2 ^ M4 ^ M5 ^ M7 ^ M9 ^ M11
R2= P2 ^ M1 ^ M3 ^ M4 ^ M6 ^ M7 ^ M10 ^ M11.
R3= P3 ^ M2 ^ M3 ^ M4 ^ M8 ^ M9 ^ M10 ^ M11.
R4= P4 ^ M5 ^ M6 ^ M7 ^ M8 ^ M9 ^ M10 ^ M11.
Here calculate bits wise location
R1= XOR (1, 3, 5, 7, 9, 11, 13,15) Table4 . Redundancy bits binary value

R1= XOR (1,0,0,1,1,1,1,0) The value “0101” is a binary bit value 5th bit i.e.
the 5th position bit is error. “011011111101011”
All 1’s are odd numbers value is ‘1’ and even
5th bit error means change the value ‘0’ to ‘1’ and
numbers are ‘0’ so value of R1 is ‘0’ (all 1’s are
we get input 15 bit data ”011011111111011”.
odd numbers value is ‘1’)
4 CORRECTION ONE ERROR BIT IN 15-BIT
The value of R1=1
DATA
R2= XOR (1,0,1,1,1,1,1,0) Given 15 bit code word is ”011011111111011” One
Here All 1’s are odd numbers value is ‘1’ and bit Error value in 15bit code word
even numbers are ‘0’ (all 1’s are odd numbers ”011011111101011”
value is ‘1’) and even numbers are ‘0’. These The value of input 15 bit data with parity bits and
values be depend on total numbers like 1 or 0. occur in
All 1’s are odd numbers value is ‘1’ and even one bit error value, here observe the one bit error
numbers are ‘0’ so the value of R2 is ‘0’ (all 1’s value of 15 bit data. Given 11 bit code word is
are even number's value is ‘0’ ) ”01101111110” and four parity bits “1111” and finally
15 bit code word is ”011011111111011” the error
The value of R2=0
value in 15 bit code word is ”011011111101011” the
R3= XOR (0,0,0,1,1,1,1,1) value of input code word one position value change
from 1 to 0.

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 105


Here which position error occur in input 15bit code  The XOR gates outputs s1,s2,s3,s4. These four
word from sender to receive.The error value of 15 bit outputs given to input of 4 to 16 deccoder as per
data where the error occur position. Then input 11bit scematic diagram. Decoder is input of value is 0101,
message bits are ”01101111100” and parity bits are and output is 5th value is high remain are 0. These
“1111” the error of bit 5th position error detection in decoder outputs given to another XOR gates, that
message bits, that position is d2. The d2 position of XOR gates one input from decoder and one input data
error correction using decoder of (4 t0 16). That output bits then get correct code of 11 message bits.
of decoder values given to correct code word of input  The receiver 11 data bits one error is detection
message bits, then finally get original message bits and correction is done given the 15-code word.
”01101111110”.
The input 11 message bits “01101111110” and parity The error d2 bit position value 0 to 1 change that
bits “1111” get 15 bit code word. And message bits value of 0 this error calculates the redundancy bit
d11=0, d10=1, d9=1, d8=0, d7=1, d6=1, d5=1, d4=1, formula here in the cadence input of 15 bit data With
d3=1, d2=1, d1=0, here parity data bits are p4=1, XORING i.e. using the XOR operation then find the
p3=1, p2=1, p1=1. output R1, R2, R3, R4 observe in CADENCE TOOL.
Error of input 11 message bits “01101111100” and
5 FIGURES
input of parity bits “1111” and message bits d11=0,
d10=1, d9=1, d8=0, d7=1, d6=1, d5=1, d4=1, d3=1,
d2=0, d1=0, here d2 value change from 1 to 0, so error
occur in receiver section.
Here solve the error detection using redundancy
formula then get position of error detection that
position of 5th location is done. Error correction is
possible using Decoder
Input message bits 11 i.e. “01101111110” and parity
bits “1111” and receiver of 11 message bits
“01101111100” error correction value is d2. So here Fig1. Schematic diagram of parity bits
using 4 to 16 decoder in correction process. identification

Process of correction:

 Message bits i.e. data bits in receiver, that bits


given to input of four XOR gates. And calculate the
parity bits of receiver message bits, not for input of
parity bits.
 The receiver of parity bits n1,n2,n3,n4 as for
scematic diagram, these parity bits given to another
XOR gates. one input is n1 parity and another input is
orginal input parity bit p1, simillaly another n2,n3,n4
and p2,p3,p4 input of XOR gates.

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 106


value in 15-bit code word

Fig 4. Architecture of correction decoder

6 ERROR DETECTION AND CORRECTION


DESIGN SIMULATION AND VALIDATION

The simulation results of input 15 bit data area

Fig5.

Fig 2. Schematic diagram for correction error Simulation results for 11-input data signal &
value in 15-bit code word 4parity input signal (15 bit data)

The values of input 11 bit data with parity bits and


occur in
one bit error value here observe the one bit error
value.
Simulation results of 11 bit data The value of input 11
bit data with parity bits and occur in one bit error
value, here observe the one bit error value in
Simulation results of 11 bit data. Given 11 bit code
word is “11001010011” Error value in 11 bit code
word is“11000010011”the value of input code word
Fig 3. Schematic diagram for detection error one position value change from 0 to 1. What position

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 107


Error occur in input 11bit data. Here one bit is error
from sender to receive.The error value in 11 bit data
where the error occur in given input datafunctionality
verification and simulation

Fig 8. 11 message bits correction one error value


simulation
7 CONCLUSION AND FUTURE SCOPE
Digital codes are being used in digital
communication for sending data. In this Paper
Hamming code is identify as the best method for
Fig 6. One bit error input of (15-bitdata) detecting and correction of Single bit error. Even
parity is used initially 11 bit data packet with 7
message bits and 4 parity bits are considered. The
single bit error appeared in this 11 bit data packet is
identified and corrected. A 15 bit data packet with 11
message bits and 4 parity bits are also considered for
the work. The single bit error appeared in this 15 bit
data packet is also identified and rectified. In future
similar work can be extended using other codes such
as cyclic codes. Future the work can be extended to
detect and correct more error bits.
REFERENCES
1 Dr. Anil Kumar Singh,”Error detection and
correction by hamming code”, 978-1-5090-0467-
6/16/$31.00 ©2016 IEEE.
Fig 7. 15-data bit no error value simulation
2.PranjaliPothare,PrajaktaAmbatkar,PayalPatre,Karish
maPadole, ShilpaLende, AnkitaBelekar “Hamming
Code For Single Bit Error Detection & Error
Correction With Even Parity Using Vhdl” (IJARCET),
Volume 4 Issue 1, January2015, pp. 262-265, 2278 –
1323.

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 108


3.Vivek Singh, RahulKumar, ManishKumarUpadhyay, 11. Jiaqiang Li and Pedro Reviriego,“Extending 3-bit
“VHDL Code for Single Bit Error Detection and Burst Error-Correction Codes With Quadruple
Correction with Even Parity Check Method Using Adjacent Error Correction” IEEE transactions on very
Xilinx” IJARSE, Vol1, Issue1, 2013. large scale integration (vlsi) systems, vol. 26, no. 2,
february 2018
4. Tongsheng Zhang and Qun Ding, “Design of (15,
11) Hamming Code Encoding and Decoding System
Based on FPGA”,978-0-7695-4519-6/11 $26.00 ©
2011 IEEE

5. Divya Mokara, “Design and Implementation of


Hamming Code using VHDL‟‟, International Journal
of Latest Engineering Research and Applications
(IJLERA) ISSN: 2455-7137 Volume – 02, Issue – 11,
November – 2017, PP – 33-40.

6. Brajesh Kumar Gupta1, RajeshwarLal Dua2 and B.


Surya Narayana Raju3 “30 Bit Hamming Code For
Error Detection And Correction With Odd Parity
Method By Using Vhdl” IJCSC Vol. 3, No. 1, June
2012.

7. Luis-J.Saiz-Adalid,et.al.,“Modified Hamming
Codes to Enhance Short Burst Error Detection in
Semiconductor Memories”, 978-1-4799-3804-9/14
$31.00 © 2014 IEEE.

8. Lankesh and K.C.Narasimhamurthy, PhD


“Hardware Implementation of Single Bit Error
Correction and Double Bit Error Detection through
Selective Bit Placement for Memory” International
Journal of Computer Applications (0975 – 8887).

9. DeepikaSS,et.al.,“A Study on Error Coding


Techniques”, www.ijraset.com Volume 4 Issue VI,
June 2016 IC Value: 13.98 ISSN: 2321-9653.

10. Achmad Fauzi, et.al.,”Bit Error Detection and


Correction with Hamming Code Algorithm” IJSRSET
| Volume 3 | Issue 1 | Print ISSN: 2395-1990 | Online
ISSN : 2394-4099.

Vol 09 Issue03, Mar 2020 ISSN 2456 – 5083 Page 109

You might also like