0% found this document useful (0 votes)
82 views2 pages

CS230 Homework: Binary & IEEE 754

Uploaded by

nickma031221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views2 pages

CS230 Homework: Binary & IEEE 754

Uploaded by

nickma031221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS230 Computer Organization

HomeWork #1 (Due: 1 week)

Name: 张三 Student ID:

1. (1 Point) Suppose we want to store the decimal number -1001 at memory address 0x400
on a 32-bit Big Endian computer.
a. Please first convert it to hexadecimal representation.
0XFFFFFC17

b. Please fill the converted hexadecimal representation in the memory.

Address ... 400 401 402 403 ...

Value ... FF FF FC 17 ...

2. (1 Point) Suppose we want to store -3.1 in IEEE 754 single-precision representation.


a. Can it be precisely stored with IEEE 754 single-precision? If not, what is the name for this
problem (overflow or underflow)?
Answer: It can not be precisely stored with IEEE 754 single-precision. Because its binary form
is a infinite recurring decimal, it cant not be precisely stored.

b. Please give its IEEE 754 single-precision representation in binary and hexadecimal format
respectively. What is its actual value in decimal representation?

Bits 31-28 27-24 23-20 19-16 15-12 11-8 7-4 3-0


Binary
(4-bit per cell, e.g: 0010)
1100 0000 0100 0110 0110 0110 0110 0110

Hex C 0 4 6 6 6 6 6

Actual decimal -3. 0999755859375

3. (1.5 Points) We are performing a 16-bit subtraction of Z = X - Y, where X = 4587.


Suppose some pieces of information are known on the 16-bit fast adder’s top-level
CLA74182 circuit, annotated by the red numbers (P1=1, C2=0, C3=1, P4=0, and C4=1).
a. Please derive the possible values of Y, you should provide evidence for your answer.
First, because X=4587, so its binary is 0001 0001 1110 1011, and subtraction so C0=1,
P1=1, so according to (1)P*=P1P2P3P4 in the first F-Adder, Y3Y2Y1Y0=0100, and G1=0. So
C1=P1C0+G1, C1=1, C2=0=P2C1+G2, so P2=0 and G2=0. And we use the formula of
(2)G*=G4+P4H3+P4P3G1+P4P3P2G1, G2=0. So G4 = 0 Y7=0, and we can get Y7Y6Y5=000,
and use (1)formula we can get Y4=0 also.So Y7Y6Y5Y4=0000. C3=1, So C3=P3C2+G3,
G3=1. And use formula (2) and X11X10X9X8=0001, soP4P3P2Y1=1, so Y11Y10Y9Y8=1111.
In the last one, G4=1, si X1514X13X12=0001, Y15Y14Y13Y12=1111.
Finally, because C0=1, so -Y=1111 1111 0000 0100, Y=0000 0000 1111 1100
So the decimal number of Y=251

b. Please give the possible results of Z, and whether overflow happens by using the signals
in the circuit for your answer.
Z=X-Y=4336.
Because C3 in the upper explanation is 1, and C4 is also equal to 1, so the Cn ⊕ Cn-1=0, it is
no overflow

4. (1.5 Points) Complete the Booth Algorithm for Binary Multiplication for the following
example, and fill in the 10-bit product.

Multiplicand: 11, Multiplier: -9


Assume 5-bit multiplicand register, 5-bit ALU, and 10-bit Product register

Step Multiplicand Action Product


0 01011 Initialization 00000 10111 0
1 01011 10: Subtract 10101 10111 0
01011 Shift right 11010 11011 1
2 01011 11:Shift right 11101 01101 1
3 01011 11:Shift right 11110 10110 1
4 01011 01:Add 01001 10110 1
01011 Shift right 00100 11011 0
5 01011 10: Subtract 11001 11011 0
01011 Shift right 11100 11101 1

The final 10-bit product (in binary) is:1110011101


The final 10-bit product (in decimal) is: -99

You might also like