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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started