Hamming Code Error Correction: Redundant Bits and Bit Position Calculations, Study notes of Computer Architecture and Organization

This document provides a technical walkthrough of the Hamming Code technique for detecting and correcting single-bit errors in data transmissions. It explains the core logic behind redundant bits and provides the specific formula used to calculate how many extra bits are required for a given data size. You will learn the exact placement of these parity bits at positions corresponding to powers of two, such as 1, 2, 4, and 8. The guide includes a step-by-step example using a 7-bit data string, demonstrating how to determine parity values and identify the precise location of an error if a bit flips during transfer. It is a practical reference for computer science students who need to understand the mathematical parity checks used to maintain data integrity in primary memory and digital communications.

Typology: Study notes

2025/2026

Available from 04/29/2026

sllmnhx
sllmnhx 🇵🇰

44 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Primary Memory
Error detection/Correction
Hamming code error-correction
Hamming code is a set of error-correction codes that can be used to
detect and correct the errors that can occur when the data is moved
or stored from the sender to the receiver. It is technique developed by
R.W. Hamming Richard Wesley Hamming for error correction.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Hamming Code Error Correction: Redundant Bits and Bit Position Calculations and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Primary Memory

Error detection/Correction

Hamming code error-correction

  • Hamming code is a set of error-correction codes that can be used to detect and correct the errors that can occur when the data is moved or stored from the sender to the receiver. It is technique developed by R.W. Hamming Richard Wesley Hamming for error correction.
  • Redundant bits
  • Redundant bits are extra binary bits that are generated and added to the information- carrying bits of data transfer to ensure that no bits were lost during the data transfer.
  • The number of redundant bits can be calculated using the following formula:

2^r ≥ m + r + 1 where, r = redundant bits, m = data bits => 2^r – r ≥ m + 1

  • Example: Calculate redundant bits for 7 bit data (2^r-r should be >= 7 +1)
  • Check for r = 3 2^r-r? 2 3 - 3? 8-3? i.e 5 Which is NOT >= 8 So r=3 is WRONG choice
  • Check for r = 4 2^r-r? 2 4 - 4? 16-4? i.e 12 Which is >= 8 So r=4 is CORRECT choice
  • i.e Minimum Redundant Bits = 4

In the case of odd parity, for a given set of bits, the number of 1’s are counted. If that count is even, the parity bit value is set to 1, making the total count of occurrences of 1’s an odd number. If the total number of 1’s in a given set of bits is already odd, the parity bit’s value is 0.

General Algorithm of Hamming code

General Algorithm of Hamming code

  • Each data bit is included in a unique set of parity bits, as determined by its bit position in binary form:
  • a. Parity bit 1 covers all the bits positions whose binary
representation includes a 1 in the least significant position ( 1, 3, 5, 7,
9, 11, etc ).
  • b. Parity bit 2 covers all the bits positions whose binary
representation includes a 1 in the second position from the least
significant bit (2, 3, 6, 7, 10, 11, etc).
  • c. Parity bit 4 covers all the bits positions whose binary representation
includes a 1 in the third position from the least significant bit (4–7,
12 – 15, 20–23, etc).
  • d. Parity bit 8 covers all the bits positions whose binary
representation includes a 1 in the fourth position from the least
significant bit bits ( 8 – 15, 24–31, 40–47, etc).

Determining the position of redundant bits –

  • These redundancy bits are placed at the positions which correspond to the power of 2. Consider this example:
  • The number of data bits = 7
  • The number of redundant bits = 4 (Using formula 2^r-r >= m+
  • The number of data bits = 7
  • The number of redundant bits = 4 (Using formula 2^r-r >= m+
  • The total number of bits = 11
  • The redundant bits are placed at positions corresponding to power of 2 ie 1, 2, 4, and 8

Suppose the data to be transmitted is 1011001 , the bits will be placed as follows and we

ERROR Correction …. Calculate Even Parities for changed Bit Position Identification positions 9,10, has changed New Number showing changed bit position

ERROR Correction …. Calculate Even Parities for changed Bit Position Identification positions 9,10, has changed New Number showing changed bit position

Error detection and correction

Suppose in the above example the 6th bit is changed from 0 to 1 during data transmission, then it gives new parity values in the binary number:

The bits give the binary number as 0110 whose decimal representation is 6. Thus, the bit 6 contains an error. To correct the error the 6th bit is changed from 1 to 0.