=========================preview======================
(COMP180)2009_s_midterm2_sol.pdf
Back to COMP180 Login to download
======================================================
Student ID:
HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY

Computer Organization (COMP 180) Spring Semester, 2009 Midterm Examination 2 Apr 17, 2009
Name: SOLUTION Student ID:
Email: Lab Section Number:

Instructions:
1.
This examination paper consists of 9 pages, with 6 questions and 1 appendix reference page.

2.
Please write your name, student ID, email and lab section number on this page.

3.
Please answer all the questions in the spaces provided on the examination paper.

4.
Please read each question very carefully, answer clearly and to the point. Make sure that your answers are neatly written.

5.
Keep all pages stapled together.

6.
Calculator and electronic devices are not allowed

7.
The examination period will last for 2 hours

8.
Stop writing immediately when the time is up.


Question Percentage % Scores
1 12
2 20
3 16
4 20
5 20
6 12
TOTAL 100

Student ID:
Question 1 Computer Arithmetic: Multiplication (12marks)
The hardware given below is designed to compute 00101(two) x 01101(two). Based on the given hardware, you are required to fill in both the Product and Remark columns of the table. The remarks should briefly describe the operations executed in the corresponding iteration. Iterations 0 and 1 are already given as examples for you to follow.

Iteration Multiplicand (M) Product (P) Remark
0 00000 01101 Initial state
1 00101 01101 00010 10110 Left(P) = Left(P) + M P = P >>1
2 (2 marks) 00010 10110 00001 01011 No operation P = P >>1
3 (4 marks) 00101 00110 01011 00011 00101 Left(P) = Left(P) + M P = P >>1
4 (4 marks) 01000 00101 00100 00010 Left(P) = Left(P) + M P = P >>1
5 (2 marks) 00100 00010 00010 00001 No operation P = P >>1

Page 2 of 9
Question 2 Floating Point Arithmetic (20 marks)
Find the sign bit, exponent, and significand representations of the numbers given in (a),
(b) and (c), using the IEEE 754 single precision floating point numbers standard. You should show clearly all the steps and intermediate results. You only need to provide up to 6 digits for the fractional precision part.
a). 118.75 (5 marks)
118 = 0111 0110, 0.75 = 0.11 Sign = 0 Exponent = 111 0110.11 = 1.11011011 x 26, 6+127=133=1000 0101 Significand = 11011011 000000000000000
0 1000 0101 11011011 000000000000000
b). 0.15 (5 marks)
0.15 = 0.00100110011001100110011 = 1.00110011001100110011. x 2-3 Sign=0, exponent=-3+127=124=0111 1100
Since the number is periodic in decimal, we need to truncate/round off the number in the representation:
(1)
providing up to 6 digits

significand = 001 100 00000000000000000 (truncated)/ 001 101 00000000000000000 (rounded)

(2)
providing up to 23 digits significand=001 1001 1001 1001 1001 1001 (truncated)/001 1001 1001 1001 1001 1010 (rounded)


11
c) . .( . ) (5 marks)
32 128
5/128=5 x 2-7= 1.01 x 2-5 Sign=1, exponent = 127-5=122=01