

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CS232 Section 6: Performance - Solutions
CP U timeX,P = Instructions executedP ∗ CP IX,P ∗ Clock cycle timeX (1)
Consider a basic machine with the following characteristics:
OP Type Freq (fi) Cycles CP Ii Load 20% 5 1. Store 10% 3 0. Branch 20% 2 0. ALU 50% 3 1.
Calculate CPI for each instruction type. Execution time before improvement: 3.2 * I * CCT. Since I and CCT remain unchanged, we will only consider CPI. How much faster would the machine be if:
(a) we added a cache to reduce average load time to 3 cycles? Originally, load instructions added 1.0 to the CPI. After decreasing the number of cycles by 2, they add .6 CPI. CPI after improvement: 2.8. Improvement: 3.
Execution time af ter improvement = T ime af f ected by improvement Amount of improvement
It’s best to optimize ALU instructions. The expected improvement is 16.7%.
(a) Itanium is three times faster (b) Itanium is one third as fast (c) Not enough information - We need cycle time and number of instruction to calculate the execution times of these machines. Comparing only CPIs, just like comparing only CCTs is misleading.
CS232 Section 6: Performance - Solutions
Functional Unit Time Delay Memory 5ns ALU 4ns Register File 3ns
Given the following instructions: lw, sw and add, calculate:
(a) Minimum time to perform each instruction (b) Time required on a single-cycle datapath
Write your answers in the table below. State any assumptions.
(a) lw (in that order): access memory (to read instruction), read operands from register file, ALU (effective address calculation), access memory (to read data) and write back to register file (the data read from memory). (b) sw (in that order): access memory (to read instruction), read operands from register file, ALU (effective address calculation), access memory (to write data). (c) add (in that order): access memory (to read instruction), read operands from register file, ALU (ALU computation based on func value) and write back to register file (value computed in ALU).
Instruction instruction time instruction in Single-Cycle datapath lw 20ns 20ns sw 17ns 20ns add 15ns 20ns
add $sp, $sp, - sub $v0, $a0, $a lw $t0, 4($sp) or $s0, $s1, $s lw $t1, 8($sp)
Assuming the instructions are executed on a single-cycle machine with 10ns cycle time, compute:
(a) cycle time - 10 ns (b) instruction latency - 10ns (c) instruction throughput - 1 instruction 10 ns
(a) cycle time - 2ns (b) instruction latency - 5 ∗ 2 ns = 10ns, just like single-cycle (c) instruction throughput - 5 instructions 18 ns - much better than single-cycle