7 - cs207d

advertisement
Princess Noura Bint Abdulrahman University
Faculty of Computer and Information Sciences
Department of the Computer Sciences
CS 207D- Computer Architecture
Second Semester 1434/1435H
Sheet #5 6
(
Q1:Answer yourself
Q2: Suppose an 8-bit data word stored in memory is 11000011. Using the Hamming
algorithm, a) Determine what check bits would be stored in memory with the data
word. Show how you got your answer.
The check bits are in bit numbers 8, 4, 2, and 1.
Check bit c8 = D12 ® D11® D10 ® D9 =1®1®0®0=0
Check bit c4= D12® D7® D6® D5 =1®0®0®1=0
Check bit c2 =D11® D10® D7® D6 ® D3 =1®0®0®0®1=0
Check bit c1 =D11® D9® D7® D5 ® D3 =1®0®0®1®1=1
Thus, the check bits are: 0 0 0 1
b) Suppose, for any reason the data bit in position 7 is error read, show how the error
detected and corrected?
The error is detected where the reading data changed to 11001011 instead of
11000011, and the check bits reading 0110 instead of 0001
0110 ®
0001
……..
0111 position 0111=position 7 has error so it is reading by wrong 1 and
corrected to 0
Position
12
11
10
9
8
7
6
5
4
3
2
1
Position
0011 0100 0101 0110 0111 1000 1001 1010 1011 1111 0010 1110
in binary
Data
Check
1
1
0
0
0
0
0
1
1
0
0
1
Q3: Answer yourself
Suppose an 8-bit data word stored in memory is 11100010. Using the Hamming
algorithm, determine what check bits would be stored in memory with the data word.
Show how you got your answer.
Position 12
11
10
9
8
7
6
5
4
3
2
1
Position
in
binary
Data
Check
a. Detect the error position if the key of the previous data was 0010 and write the
data after correction
b. How many check bits are needed if the Hamming error correction code is used
to detect single bit errors in a 256-bit data word? Show how you get your result.
Q4: For the 8-bit word 00111001, the check bits stored with it would be 0111.
Suppose when the word is read from memory, the check bits are calculated to be
1101.What is the data word that was read from memory?
The Hamming Word initially calculated was:
bit number:
12
0
11
0
10
1
9
1
8
0
7
1
6
0
5
0
4
1
3
1
2
1
1
1
Doing an exclusive-OR of 0111 and 1101 yields 1010 indicating an error in bit 10 of
the Hamming Word. Thus, the data word read from memory was 00011001.
Q5: How many check bits are needed if the Hamming error correction code is used
to detect single bit errors in a 1024-bit data word?
Need K check bits such that 2K – 1 >= 1024 + K.
The minimum value of K that satisfies this condition is 11.
Download