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


Mid-term Examination
March 24, 2003
Name: ___Solutions _________________ _ Student Number: ____________________
Email: ____________________________ Lab Section Number:
Instructions:
1.
This examination paper consists of 11 pages, 5 questions and 1 appendix reference page.

2.
Please write your name, student ID and Email on this page.

3.
For each subsequent page, please write your student ID at the top of the page in the space provided.

4.
Please answer all the questions within the space provided on the examination paper. You may use the back of the pages for your rough work and afterwards drawn a diagonal line through it to show that it is not part of your answer.

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

6.
Leave all pages stapled together.

7.
The examination period will last for 1 hour and 45 minutes.

8.
Stop writing immediately when the time is up.


Questions Marks Scores
1 20
2 20
3 20
4 20
5 20
TOTAL 100

Question 1. (20 marks)
a) Give the definitions to the following terms. (Use formula to express the meaning) (6 marks)
1.
CPI

CPI = CPU clock cycles/instruction count (from the slice#16)

2.
MIPS

million instructions per second, MIPS = Instruction count/execution time x 106 (from the slice# 24)

3.
MFLOPS


million floating-point operations per second, MFLOPS = number of floating point operations/execution time x 106 (from the slice#25)
b) A program takes 20 seconds to run on a 800 MHz machine (computer A). We want to design a faster machine (computer B) that can run the same program in 12 seconds. The increase in clock rate affects the rest of the CPU design, causing machine B to require 1.5 times as many clock cycles as machine A for the program. What clock rate should machine B have? (Show your steps clearly) (6 marks)
clock rateB
= (clock cyclesB)/(CPU timeB)
= (1/CPU timeB) x (clock cyclesB/ clock cyclesA) x (clock cyclesA)
= (1/CPU timeB) x (clock cyclesB/ clock cyclesA) x clock rateA x CPU timeA
= clock rateA x (clock cyclesB/ clock cyclesA) x (CPU timeA/CPU timeB)
= 800M x 1.5 x (20/12)
= 2GHz

c) Consider the machine with 3 instruction classes and CPI measurements, as listed below. (8 marks) Instruction classes CPI for each instruction class
A 1
B 2
C 3

Now suppose we measure the code for the same program from two different compilers and obtain the following data.
Instruction counts (in billions, 109) for each instruction class
Code from A B C
Compiler 1 5 1 1
Compiler 2 10 1 1

Assume that the machines clock rate is 500 MHz.
1. What are the CPU clock cycles for compiler 1 and compiler 2 respectively? (S