Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Computer Org. Homework 2 - Instruction Execution Time & CPU Performance, Assignments of Computer Architecture and Organization

A computer organization homework assignment from the winter 2008 semester. The assignment includes various questions related to instruction execution time, cpu performance, and optimization. Students are required to calculate the time taken to execute a given code on a cpu with a specific clock frequency, compare the peak mips ratings of two different cpu implementations, determine the number of multiplication replacements in an optimized program, and analyze the speedup of various cpu enhancements.

Typology: Assignments

2009/2010

Uploaded on 03/28/2010

koofers-user-o5e
koofers-user-o5e 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 2
Computer Organization (0306-550) - Winter 2008
Homework Assignment #2 - Due January 8
Show all intermediate steps clearly and legibly to obtain full credit.
1. Assume that the code given in Exercise 2.30 (page 150) in the textbook is run on
a CPU with a clock frequency of 1.6 GHz, that requires the following number of
cycles for each instruction.
Instruction Cycles
add, addi, sll 3
bne 4
lw 7
Ignoring the four instructions before the loops, how many seconds will it take to
execute this code in the worst case?
2. Consider two different CPU implementations of the same instruction set: CPU1
and CPU2. This instruction set has five classes (A, B, C, D, and E) of instructions
whose CPIs for each CPU are given in the table below. CPU1 has a clock rate of
2 GHz, and CPU2 has a clock rate of 2.4 GHz
Class CPI1CPI2
A 1 3
B 3 3
C 4 3
D 5 4
E 6 4
a. What are the peak MIPS ratings of CPU1 and CPU2 ?
b. If the number of instructions executed in a certain program is divided equally
among these instruction classes except for class A, which occurs five times as
often as each of the other classes, which CPU implementation is faster for this
program (i.e., CPU1 or CPU2), and by how much?
3. Exercise 4.10, page 273 in the textbook.
4. Consider program P running on a 1-GHz machine M in 10 seconds. Someone
optimizes P by replacing each of 4x108 instances of multiplying a value x by 2
(mult x,x,2) each with a single add instruction (add x,x,x) and by replacing all
instances of multiplying by 4 (mult x,x,4) each with a single shift instruction
(sll x,x,2). The optimized program P runs in 8 seconds on the same machine.
If the CPI of mult is 6, the CPI of add is 2, and the CPI of sll is 1, how
many multiplies by 4 were replaced with sll instructions by the optimization?
pf2

Partial preview of the text

Download Computer Org. Homework 2 - Instruction Execution Time & CPU Performance and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Page 1 of 2

Computer Organization (0306-550) - Winter 2008

Homework Assignment #2 - Due January 8

Show all intermediate steps clearly and legibly to obtain full credit.

  1. Assume that the code given in Exercise 2.30 (page 150) in the textbook is run on a CPU with a clock frequency of 1.6 GHz, that requires the following number of cycles for each instruction.

Instruction Cycles add, addi, sll 3 bne 4 lw 7

Ignoring the four instructions before the loops, how many seconds will it take to execute this code in the worst case?

  1. Consider two different CPU implementations of the same instruction set: CPU 1 and CPU 2. This instruction set has five classes (A, B, C, D, and E) of instructions whose CPIs for each CPU are given in the table below. CPU 1 has a clock rate of 2 GHz, and CPU 2 has a clock rate of 2.4 GHz

Class CPI 1 CPI (^2) A 1 3 B 3 3 C 4 3 D 5 4 E 6 4

a. What are the peak MIPS ratings of CPU 1 and CPU 2?

b. If the number of instructions executed in a certain program is divided equally among these instruction classes except for class A, which occurs five times as often as each of the other classes, which CPU implementation is faster for this program (i.e., CPU 1 or CPU 2 ), and by how much?

  1. Exercise 4.10, page 273 in the textbook.
  2. Consider program P running on a 1-GHz machine M in 10 seconds. Someone optimizes P by replacing each of 4x10 8 instances of multiplying a value x by 2 (mult x , x ,2) each with a single add instruction (add x , x , x ) and by replacing all instances of multiplying by 4 (mult x , x ,4) each with a single shift instruction (sll x , x ,2). The optimized program P′ runs in 8 seconds on the same machine. If the CPI of mult is 6, the CPI of add is 2, and the CPI of sll is 1, how many multiplies by 4 were replaced with sll instructions by the optimization?

0306-550 Winter 2008 Homework Assignment #2 Page 2 of 2

  1. Suppose you have a program that runs in 100 seconds on a particular computer, and profiling of the execution time indicates that 20% is for multiplication, 50% is for memory access, and 30% for other instructions.

a. Determine the speedup for these enhancements to the computer. i. Make multiply instructions run ten times faster. ii. Make memory access instructions run three times faster. iii. Make both enhancements i and ii.

b. Suppose you change the program so that the execution time distribution is no longer 20%, 50%, and 30%. If none of the percentages can be zero, what sort of program would result in a tie (with regard to speedup) between the two individual enhancements above? Provide both a formula and some examples.

  1. Three enhancements are used to improve three execution aspects of a CPU, where each enhancement affects a different portion of the execution time, with the following enhancement factors:

Enhancement #1 factor = 6 Enhancement #2 factor = 4 Enhancement #3 factor = 3

For a specific application, enhancements 1, 2, 3 are useable 15%, 10%, and 5% of the resulting execution time after the enhancements were applied, respectively.

a. What is the overall speedup obtained?

b. What where the fractions of original execution time where each enhancement was applied?

  1. a. If multiply instructions require 13 cycles and account for 28% of the instructions executed in a typical program, what percentage of time does the CPU spend on multiplication if the average CPI of all other instructions is 6?

b. Suppose that you could reduce the number of cycles for multiplication to 8 but that the CPU cycle time would need to be increased by 15%. Should you make this modification?