본문 바로가기
Computer Science/Computer Architecture & Organization

CA & CO Chapter 10 practice problem

by HaningYa 2020. 5. 23.
728x90

Given x = 0101 and y = 1010 in twos complement notation (i.e., x = 5, y = -6), compute the product p = x * y with Booth's algorithm.

A Q Q(-1) M  
0000 1010 0 0101 Initial
0000 0101 0 0101 Shift
1011
1101
0101
1010
0
1
0101
0101
A  <- A - M
Shfit
0010
0001
1010
0101
1
0
0101
0101
A <- A + M
Shift
1100
1110
0101
0010
0
1
0101
0101
A <- A - M
Shiift

 

Express the following numbers in IEEE 32-bit floating-point format:

  • -5 
    1 10000001 01000000000000000000000
  • -6
    1 10000001 10000000000000000000000
  • -1.5
    1 01111111 10000000000000000000000
  • 384
    0 10000111 10000000000000000000000
  • 1/16
    1/16 = 0.0001 = 1.0 × 2–100
    127 – 4 = 123 = 01111011
    0 01111011 00000000000000000000000
  • -1/32
    –1/32 = –0.00001 = –1.0 × 2–101
    127 – 5 = 122 = 01111010
    0 01111010 00000000000000000000000

 

The following numbers use the IEEE 32-bit floating-point format. What is equivalent decimal value?

a. 1 10000011 11000000000000000000000
sign = -
exponent = 131 – 127 = 4
1.11 x 2^4 = 11100 = 28
-28

b. 0 01111110 10100000000000000000000
sign = +
exponent = 126 – 127 = -1
1.101 x 2^(-1) = .1101 = ½ + ¼ + 1/16 = .8125
.8125

c. 0 10000000 00000000000000000000000
sign = +
exponent = 128 – 127 = 1
1.0 x 2^1 = 10 = 2
2

Express the following numbers in IBM's 32-bit floating-point format, which uses a 7-bit exponent with an implied base of 16 and an exponent bias of 64 (40 hexadecimal). A normalized floating-point number requires that the leftmost hexadecimal digit be nonzero; the implied radix point is to the left of that digit.

a. 1.0 = +1/16 × 16^1 = 0 100 0001 0001 0000 0000 0000 0000 0000

b. 0.5 = +8/16 × 16^0 = 0 100 0000 1000 0000 0000 0000 0000 0000

c. 1/64 = +4/16 × 16^(–1) = 0 011 1111 0100 0000 0000 0000 0000 0000

d. 0.0 = +0 × 16^(–64) = 0 000 0000 0000 0000 0000 0000 0000 0000

e. –15.0 = –15/16 × 16^1 = 1 100 0001 1111 0000 0000 0000 0000 0000

f. 5.4 × 10^(–79) ≈ +1/16 × 16^(–64) = 0 000 0000 0000 0000 0000 0000 0000 0000

g. 7.2 × 10^75 ≈ 1 × 1663 = 0 111 1111 1111 1111 1111 1111 1111 1111

h. 65535 = 16^4 –1 = 0 100 0100 1111 1111 1111 1111 0000 0000

728x90

댓글