Академический Документы
Профессиональный Документы
Культура Документы
Alex Pinos
alex.pinos@ucuenca.edu.ec
11181 - Organización y Arquitectura de Computadores
Universidad de Cuenca
Question 1
Describe the steps that transform a program written in a high-level language such
as C into a representation that is directly executed by a computer processor.
A compiler converts a high level language like C into assembly language, this assembly code
is converted by an assembler to binary machine language.
Question 2
Describe your understanding of ISA from both an Abstraction and an Imple-
mentation perspectives.
The ISA is an abstraction of the details and instructions that a machine needs to follow to
run binary code, this abstraction allows different hardware that implements the architecture
to run the same software without a problem.
Question 3
Consider three different processors P1, P2, and P3 executing the same instruc-
tion set. P1 has a 3 GHz clock rate and a CPI of 1.5. P2 has a 2.5 GHz clock
rate and a CPI of 1.0. P3 has a 4.0 GHz clock rate and has a CPI of 2.2.
Question 3.a
Which processor has the highest performance expressed in instructions per sec-
ond?
We know that:
Instructions × CP I
CP U time =
clockrate
From where we get:
Instructions clockrate
IP S = =
CP U time CP I
1
Using the IPS equation, we find the values for each processor.
We know that:
1GHz = 1 × 109 Hz
3×109 Hz
P1) IP S = 1.5
= 2 × 109 instructions
s
2.5×109 Hz
P2) IP S = 1
= 2.5 × 109 instructions
s
4×109 Hz
P3) IP S = 2.2
= 1.82 × 109 instructions
s
Processor P1 has the highest performance with 2.5 × 109 instructions per second.
Question 3.b
If the processors each execute a program in 10 seconds, find the number of cycles
and the number of instructions.
From:
clockcycles
CP U time =
clockrate
We get:
clockcycles = clockrate × CP U time
clockcyclesP 1 = 3 × 109 Hz × 10s = 30 × 109 cycles
clockcyclesP 2 = 2.5 × 109 Hz × 10s = 25 × 109 cycles
clockcyclesP 3 = 4 × 109 Hz × 10s = 40 × 109 cycles
From:
instructions × CP I
CP U time =
clockrate
We get:
clockrate × CP U time
instructions =
CP I
3×109 Hz×10s
instructionsP 1 = 1.5
= 20 × 109 instructions
9
2.5×10 Hz×10s
instructionsP 2 = 1
= 25 × 109 instructions
4×109 Hz×10s
instructionsP 3 = 2.2
= 40 × 109 instructions
Question 3.c
We are trying to reduce the execution time by 30% but this leads to an increase
of 20% in the CPI. What clock rate should we have to get this time reduction?
We need to find the clock rate to satisfy the next couple of relations: -Reducing execution
time of A by 0.3
CP U timeB = 0.7CP U timeA
2
-Increasing CPI of A by 0.2
CP IB = 1.2CP IA
We know that:
Instructions × CP I
CP U time =
clockrate
Combining it with the first relations we get:
InstructionsB × CP IB 0.7InstructionsA × CP IA
=
clockRateB clockRateA
CP IB 0.7CP IA
=
clockRateB clockRateA
1.2CP IA 0.7CP IA
=
clockRateB clockRateA
1.2
clockRateB = clockRateA = 1.71clockRateA
0.7
Question 4
Consider two different implementations of the same instruction set architecture.
The instructions can be divided into four classes according to their CPI (class
A, B, C, and D). P1 with a clock rate of 2.5 GHz and CPIs of 1, 2, 3, and 3, and
P2 with a clock rate of 3 GHz and CPIs of 2, 2, 2, and 2.
Given a program with a dynamic instruction count of 1.0E6 instructions divided into classes
as follows: 10% class A, 20% class B, 50% class C, and 20% class D, which implementation
is faster?
Processor A B C D
P1 1 2 3 3
P2 2 2 2 2
3
We know that: n
X
clockcycles = CP I x instructions
i=1
clockcycles
CP I =
instructions
The CPI for the first processor is 2.6 and its clock cycles 2.6 × 106 .
The CPI for the second processor is 2 and its clock cycles 2 × 106 .
Question 5
Compilers can have a profound impact on the performance of an application.
Assume that for a program, compiler A results in a dynamic instruction count
of 1.0E9 and has an execution time of 1.1s, while compiler B results in a dynamic
instruction count of 1.2E9 and an execution time of 1.5s.
Question 5.a
Find the average CPI for each program given that the processor has a clock cycle
time of 1ns.
We know that:
clockcycles
CP I =
instructions
CP U time
clockcycles =
clockcycletime
CP U time
CP I =
clockcycletime × instructions
We get:
1.1s
CP IA = = 1.1
10−9 s
× 109
1.5s
CP IB = −9 = 1.25
10 s × 1.2 × 109
4
Question 5.b
Assume the compiled programs run on two different processors. If the execution
times on the two processors are the same, how much faster is the clock of the
processor running compiler A’s code versus the clock of the processor running
compiler B’s code?
Question 5.c
A new compiler is developed that uses only 6.0E8 instructions and has an average
CPI of 1.1. What is the speedup of using this new compiler versus using compiler
A or B on the original processor?
We find the ratio of performance of the code from different compilers.
Question 6
Assume a program requires the execution of 50 × 106 FP instructions, 110 × 106
INT instructions, 80 × 106 L/S instructions, and 16 × 106 branch instructions. Th
e CPI for each type of instruction is 1, 1, 4, and 2, respectively. Assume that
the processor has a 2 GHz clock rate.
Question 6.a
By how much must we improve the CPI of FP instructions if we want the
program to run two times faster?
We know that:
5
P
instructions × CP I
CP U time =
clockrate
50 × 10 + 110 × 10 + 4 × 80 × 106 + 2 × 16 × 106
6 6
CP U time = = 256 × 10−3 s
2 × 109 Hz
We want the time to be two times faster so we divide the CPUtime by 2.
256 × 10−3
CP U timenew = = 128 × 10−3 s
2
We replace the CPI of FP for a unknown variable CP U timenew and equal it to the new time
above, solving for the variable.
Question 6.b
By how much must we improve the CPI of L/S instructions if we want the
program to run two times faster?
We use the same new CPUtime as in part a and the solving logic:
Question 6.c
By how much is the execution time of the program improved if the CPI of INT
and FP instructions is reduced by 40% and the CPI of L/S and Branch is reduced
by 30%?
We know that:
CP Inew = unitReduced × CP Ioriginal
6
Reduced 40%:
CP Iint = 0.6 × 1 = 0.6
CP If p = 0.6 × 1 = 0.6
Reduced 30%:
CP Il/s = 0.7 × 4 = 2.8
CP Ibranch = 0.7 × 2 = 1.4
We know that: P
instructions × CP I
CP U timenew =
clockrate
And using the new CPI values we find the new CPUtime
Question 7
Share your overleaf project with diego.monterob@ucuenca.edu.ec.
Share the overleaf project with diego.monterob@ucuenca.edu.ec