=========================preview======================
(COMP180)cs180_quiz_II_spring03.pdf
Back to COMP180 Login to download
======================================================
HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY
Computer Organization (COMP 180)
Spring Semester, 2003


Quiz 2
May 9, 2003
(Time allowed: 40 minutes)
Name: Student Number:
Email: Lab Section Number:

Total Score:
Answer ALL questions in the space provided.
1. (10 points) For each of the following statements, write down true if it is true and false otherwise. (2 points each)
(a)
We always have to compare the exponents of two numbers first when performing floating-

point addition. Ans:___true__

(b)
In the IEEE 754 floating-point double precision representation, the size of the exponent is

double of that in the single precision. Ans:__false__

(c)
Twos complement is not used in the IEEE 754 floating-point representation for

representing signed integers. Ans:___true__

(d)
The equation dividend = quotient divisor + remainder holds for both signed and

unsigned integers. Ans:___true__

(e)
In a floating-point representation, overflow/underflow occurs if the significand field is not


large enough to hold the value. Ans:__false__
1

2. (a) (30 points) Using the integer multiplication algorithm (final version) discussed in class, show all the steps involved when two 2-bit binary numbers 11 (multiplicand) and 10 (multiplier) are multiplied to obtain the product. You have to show the steps by completing the table below.

Hints: Remarks can be as the following examples: No operation, Left(P) = Left(P) + M, Right(P) = Right(P) + M, P = P >> 1 or P = P << 1.
(b) (12 points) Given the bit pattern of X:
X = 8FEFC000hex
(i)
If X represents a twos complement integer, then what is the value of X?
(Show all steps)


X = - ( 230 + 229 + 228 + 220 + 214 )
= -1880113152
-1.88 x 109


(ii)
If X represents an unsigned integer, then what is the value X? (Show all steps)


X = 231 + 227 + 226 + 225 + 224 + 223 + 222 + 221 + 219 + 218 + 217 + 216 + 215 + 214 = 2414854144 2.41 x 109
(iii)If X represents a single-precision floating-point number (IEEE 754 Standard), then what is the value X? (Show all steps)
S = 1
E = 00011111(binary) = 31
F = 2-1 + 2-2 + 2-4 + 2-5 + 2-6 + 2-7 + 2-8 + 2-9

X = (-1)s x (1.F) x (2)E-127
= -2.3641e-029

2

3. (48 points) Consider the execution of the instruction lw $s2, 12($s1) under a single-cycle datapath implementation.

Recall that the register numbers for $s1 and $s2 are:
$s1: 17ten or 10001two
$s2: 18ten or 10010two

Suppose the content of register $s1 is 19ten or 10011two. Fill in the blank entries in the table below. Dont care bit values should be denoted by X. Be sure that the number of bits in the last column (data or address) should be equal to the number given in the second column (number of bits).
Number of bits Data or address
Read register 1 5 10001
Read register 2 5 XXXXX
Write register 5 10010
Read (register) data 1 32 00...0010011