75% found this document useful (4 votes)
6K views11 pages

Hamming Code

The document discusses 8-bit Hamming code for error detection and correction in communication networks. It explains that Hamming code adds parity check bits to data words to generate error syndromes and identify specific bits in error. As an example, it shows how a 4-bit Hamming code is used to encode an 8-bit data word into a 12-bit code word, including calculating the parity bits. It then describes how to detect and locate errors by comparing calculated and stored check bits. Finally, it discusses how to determine check bit locations and how Hamming code can detect double errors with an additional parity bit.

Uploaded by

Shoubhik Pande
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
75% found this document useful (4 votes)
6K views11 pages

Hamming Code

The document discusses 8-bit Hamming code for error detection and correction in communication networks. It explains that Hamming code adds parity check bits to data words to generate error syndromes and identify specific bits in error. As an example, it shows how a 4-bit Hamming code is used to encode an 8-bit data word into a 12-bit code word, including calculating the parity bits. It then describes how to detect and locate errors by comparing calculated and stored check bits. Finally, it discusses how to determine check bit locations and how Hamming code can detect double errors with an additional parity bit.

Uploaded by

Shoubhik Pande
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

8 Bit Hamming Code Correction And

Detection

Presented by TE-1
-Shoubhik Pande 39
-Vijay Nair 44
-Viral Nagda 45
-Pritesh Varsolkar 50
Error Detection and Correction
 Improve the performance of communication
network
 A simple error detection scheme
 a parity bit
 a single bit error can be detected, but cannot be
corrected
 An error-correction code
 generates multiple parity check bits
 the check bits generate a unique pattern, called a
syndrome
 the specific bit in error can be identified
Hamming Code
 k parity bits are added to an n-bit data word to
form a new word of n+k bits
 Criteria: (2k –1  n + k)
 The bit positions are numbered in sequence from 1
to n + k
 Those positions numbered as a power of 2 are
reserved for the parity bits
 The remaining bits are the data bits
Example: 8-bit data word 11000100
 Include 4 parity bits and the 8-bit word  12 bits
2k –1  n + k, n = 8  k = 4
Bit position: 1 2 3 4 5 6 7 8 9 10 11 12
P1 P2 1 P4 1 0 0 P8 0 1 0 0
 Calculate the parity bits: even parity  assumption
P1 = XOR of bits (3, 5, 7, 9, 11) = 1  1  0  0  0 = 0
P2 = XOR of bits (3, 6, 7, 10, 11) = 1  0  0  1  0 = 0
P4 = XOR of bits (5, 6, 7, 12) = 1  0  0  0 = 1
P8 = XOR of bits (9, 10, 11, 12) = 0  1  0  0 = 1
 Store the 12-bit composite word in memory.
Bit position: 1 2 3 4 5 6 7 8 9 10 11 12
0 0 1 1 1 0 0 1 0 1 0 0
How to Check?
 When the 12 bits are read from the memory
 Check bits are calculated
C1 = XOR of bits (1, 3, 5, 7, 9, 11)=XOR of bits(1, P1)
C2 = XOR of bits (2, 3, 6, 7, 10, 11)=XOR of bits(2, P2)
C4 = XOR of bits (4, 5, 6, 7, 12)=XOR of bits(4, P4)
C8 = XOR of bits (8, 9, 10, 11, 12)=XOR of bits(8, P8)

 If no error has occurred


Bit position: 1 2 3 4 5 6 7 8 9 10 11 12
0 0 1 1 1 0 0 1 0 1 0 0
 C = C8C4C2C1 = 0000
When Error Happen !!
 One-bit error
 error in bit 1
 C1 = XOR of bits (1, 3, 5, 7, 9, 11) = 1
 C2 = XOR of bits (2, 3, 6, 7, 10, 11) = 0
 C4 = XOR of bits (4, 5, 6, 7, 12) = 0
 C8 = XOR of bits (8, 9, 10, 11, 12) = 0
 C8C4C2C1 = 0001
 error in bit 5
 C8C4C2C1 = 0101
 Two-bit error
 errors in bits 1 and 5
 C8C4C2C1 = 0100  can not detect !!
 12-bit Hamming code word containing 8 bits of data
and 4 parity bits is read from memory.
 What was the original 8-bit data word that was written into
memory if the 12-bit word read out is 000011101010?
 Answer
Bit position: 1 2 3 4 5 6 7 8 9 10 11 12
P1 P2 0 P4 1 1 1 P8 1 0 1 0
 C1 = XOR of bits (1, 3, 5, 7, 9, 11) = 0
 C2 = XOR of bits (2, 3, 6, 7, 10, 11) = 1
 C4 = XOR of bits (4, 5, 6, 7, 12) = 1
 C8 = XOR of bits (8, 9, 10, 11, 12) = 0
 C=0110  Error in bit 6  correct 8-bit data 01011010
How to Determine Check Bits Locations?
 Bit position: 1 2 3 4 5 6 7 8 9 10 11 12
P1 P2 D7 P4 D6 D5 D4 P8 D3 D2 D1 D0
 Check bits (cb) locations:
C1 = XOR of bits (1, 3, 5, 7, 9, 11)
C2 = XOR of bits (2, 3, 6, 7, 10, 11)
C4 = XOR of bits (4, 5, 6, 7, 12)
C8 = XOR of bits (8, 9, 10, 11, 12)
….
cb for 2k-1=XOR of bits with 2k-1 set in their bit #
Single-Error Correction, Double-Error
Detection
 Hamming code
 Can detect and correct only a single error
 Multiple errors may not be detected
 Hamming code + a parity bit
 Can detect double errors and correct a single error.
 The additional parity bit is the XOR of all the other
bits
 E.g.: the previous 12-bit coded word
0 0 1 1 1 0 0 1 0 1 0 0 P13  0 0 1 1 1 0 0 1 0 1 0 0 1 (even
parity).
Applications:
 Hamming code is useful for detecting and
correcting errors.
 VHDL implementation of Hamming code can be
part of soft core communication system.
THANK YOU

You might also like