0% found this document useful (0 votes)
42 views

Hamming Code

This document discusses using a Hamming code to detect errors in an 8-bit data word stored in memory and fetched from memory. The key points are: 1. A 4-bit Hamming code is used, requiring 12 bits total. 2. The check bits for the stored word and fetched word are calculated. 3. A difference is found between the check bits, indicating a error in bit position 8 of the fetched word.

Uploaded by

Muhammad Azrul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Hamming Code

This document discusses using a Hamming code to detect errors in an 8-bit data word stored in memory and fetched from memory. The key points are: 1. A 4-bit Hamming code is used, requiring 12 bits total. 2. The check bits for the stored word and fetched word are calculated. 3. A difference is found between the check bits, indicating a error in bit position 8 of the fetched word.

Uploaded by

Muhammad Azrul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MUHAMMAD AZRUL BIN NOOR AZMI

1811839
Exercise Week 8

Exercise on Hamming Code


An 8-bit data word stored in memory is 00111100, while word fetched from the memory is
00101100.
1) How many check bits should be combined in word stored and word
fetched?

Using try and error formula 2K - 1 ≥ M + K


M = 8, If K=4

24 - 1 ≥ 8 + 4

15 ≥ 12 -> True
K=4
2) Find check bits in word stored.
Word = 8 + 4 = 12 bits

Bit position 23 22 21 20
12 11 10 9 8 7 6 5 4 3 2 1

Check bits C8 C4 C2 C1

Data bit D8 D7 D6 D5 D4 D3 D2 D1

Word stored 0 0 1 1 0 1 1 0 0 0 1 1

C1 = D1 ⊕ D2 ⊕ D4 ⊕ D5 ⊕ D7 Check bit

C1 0 ⊕ 0 ⊕ 1 ⊕ 1 ⊕ 0 1

C2 = D1 ⊕ D3 ⊕ D4 ⊕ D6 ⊕ D7

C2 0 ⊕ 1 ⊕ 1 ⊕ 1 ⊕ 0 1

C4 = D2 ⊕ D3 ⊕ D4 ⊕ D8

C4 0 ⊕ 1 ⊕ 1 ⊕ 0 0

C8 = D5 ⊕ D6 ⊕ D7 ⊕ D8

C8 1 ⊕ 1 ⊕ 0 ⊕ 0 0
3) Find check bits in word fetched.

Bit position 23
22
2 1
2
0

12 11 10 9 8 7 6 5 4 3 2 1

Check bits C8 C4 C2 C1

Data bit D8 D7 D6 D5 D4 D3 D2 D1

Word stored 0 0 1 1 0 1 1 0 0 0 1 1

Word fetch 0 0 1 0 1 1 1 0 0 0 1 1

C1 = D1 ⊕ D2 ⊕ D4 ⊕ D5 ⊕ D7 Check bit

C1 0 ⊕ 0 ⊕ 1 ⊕ 0 ⊕ 0 1

C2 = D1 ⊕ D3 ⊕ D4 ⊕ D6 ⊕ D7

C2 0 ⊕ 1 ⊕ 1 ⊕ 1 ⊕ 0 1

C4 = D2 ⊕ D3 ⊕ D4 ⊕ D8

C4 0 ⊕ 1 ⊕ 1 ⊕ 0 0

C8 = D5 ⊕ D6 ⊕ D7 ⊕ D8

C8 0 ⊕ 1 ⊕ 0 ⊕ 0 1

4) Find which bit position contains error.

C8 C4 C2 C1

0 0 1 1
Word Stored =
Word Fetch = ⊕ 1 0 1 1

1 0 0 0

1 0 0 0 change to decimal = 8
Error is in position 8

You might also like