Question: A designer has to optimize the performance of a compiler on a given machine. The hardware designers provide the following documentation: Instruction class CPI for

A designer has to optimize the performance of a compiler on a given machine. The hardware

designers provide the following documentation:

Instruction class CPI for this class of instruction

A 10

B 12

C 15

D 30

The compiler designer has to decide between two different code sequences for a certain high

level statement. The table below gives the number of times each instruction class is used in each

code sequence:

Code sequence Instruction counts for instruction class

A B C D

Code 1 5 6 6 2

Code 2 6 8 8 1

(a) Find out the total numbers of clock cycles used for each code sequence. (5 points)

(b) Find out the average CPI for each code sequence. (5 points)

(c) Find out the execution time considering that the CPU is a 400 MHz machine. (Assume all the

CPU time is dedicated to executing these instructions) Which code will give better

performance? (10 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!