Docsity

Midterm Exam 1 Practice Problems Solutions - Computer Architecture | EEL 4713, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
EEL 4713/5764, Spring 2006 – Computer Architecture
Midterm #1 – Practice Problems - SOLUTIONS
Out Sat., Feb. 4
The following example problems are representative of the general type and level of
difficulty of problems you might see on the real miderm.
Problem 1. Performance metrics (CIO 1 aeo).
Suppose you are in a design scenario with a power budget of Pmax, a cost budget of Cmax,
and where you are building a high-performance parallel system out of processors that
each consume power Punit, have cost Cunit, and have a throughput of Tunit. You are trying
to decide whether to switch your system design over to use a different kind of processor
chip that consumes 60% as much power as one of the original chips, costs 50% more per
chip, and finishes a work unit in 80% of the time that is required on one of the original
processor chips. The overall system needs to be able to complete as many work units as
possible per unit of time. (For this problem, assume that the processors are equivalent in
respects other than the above, and that your application has enough parallel work units as
needed to keep any number of processors busy.)
In the following, show your calculations:
i) On your work units, how many times higher performance does an individual one of the
new processors have, compared to one of the old ones?
80% the time 1/.8 = 1.25 higher performance
ii) The cost-performance of the new processors is ___% larger/smaller (circle one) than
the old ones?
cost-performance (CP) = performance / cost
relative CP = relative perf. / relative cost = 1.25 / 1.50 =
0.83333…
The cost-performance is 100%−83.3% or 16.67% smaller than
before.
iii) The power-performance of the new chips is ___ the power-performance of the old
ones?
power-perf (PP) = perf / power
relative PP = rel. perf. / rel. pwr. = 1.25 / 0.6 = 2.08333…
iv) Identify the nature of the engineering problem you should be trying to solve in the
above scenario. What specific quantity should you really be trying to maximize here, and
within what constraints?
pf3
pf4

Partial preview of the text

Download Midterm Exam 1 Practice Problems Solutions - Computer Architecture | EEL 4713 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

EEL 4713/5764, Spring 2006 – Computer Architecture

Midterm #1 – Practice Problems - SOLUTIONS

Out Sat., Feb. 4

The following example problems are representative of the general type and level of

difficulty of problems you might see on the real miderm.

Problem 1. Performance metrics (CIO 1 aeo).

Suppose you are in a design scenario with a power budget of P max , a cost budget of C max

and where you are building a high-performance parallel system out of processors that

each consume power P unit , have cost C unit , and have a throughput of T unit

. You are trying

to decide whether to switch your system design over to use a different kind of processor

chip that consumes 60% as much power as one of the original chips, costs 50% more per

chip, and finishes a work unit in 80% of the time that is required on one of the original

processor chips. The overall system needs to be able to complete as many work units as

possible per unit of time. (For this problem, assume that the processors are equivalent in

respects other than the above, and that your application has enough parallel work units as

needed to keep any number of processors busy.)

In the following, show your calculations:

i) On your work units, how many times higher performance does an individual one of the

new processors have, compared to one of the old ones?

80% the time  1/.8 = 1.25 higher performance

ii) The cost-performance of the new processors is ___% larger/smaller (circle one) than

the old ones?

cost-performance (CP) = performance / cost

relative CP = relative perf. / relative cost = 1.25 / 1.50 =

The cost-performance is 100%−83.3% or 16.67% smaller than

before.

iii) The power-performance of the new chips is ___ the power-performance of the old

ones?

power-perf (PP) = perf / power

relative PP = rel. perf. / rel. pwr. = 1.25 / 0.6 = 2.08333…

iv) Identify the nature of the engineering problem you should be trying to solve in the

above scenario. What specific quantity should you really be trying to maximize here, and

within what constraints?

We should be trying to maximize system performance (total

throughput) within the cost and power constraints.

v) Formulate a mathematical expression (inequality) describing the precise conditions

under which you ought to switch to the new processor, in terms of the variables and

constants given above.

We should make the switch if new total throughput is greater than old

total throughput:

T

tot,new

≥ T

tot,old

Within the cost and power constraints,

T

tot,old

= T

unit  min( P max

/ P

unit

, C

max

/ C

unit

T

tot,new

= ( T

unit /80%)  min[ P max

/( P

unit

60%), C

max

/( C

unit

150%)] 

Thus, the overall inequality that must be satisfied to make the switch

is:

( T

unit /80%)  min[ P max

/( P

unit

60%), C

max

/( C

unit

150%)] 

≥ T

unit  min( P max

/ P

unit

, C

max

/ C

unit

If we like, we can also cancel out T unit and simplify slightly to:

1.25  min[ P max

/(.6 P

unit

), C

max

/(1.5 C

unit )]  ≥ min( P max

/ P

unit

, C

max

/ C

unit

vi) Solve the problem. Supposing that your power budget is 1 kW, your cost budget is

$100,000, and the original processors each consumed 100W and cost $2,000, should you

make the switch to the new processors, or not? Show your calculations, and explain.

P

max

= 1000 W, C

max

P

unit

= 100 W, C

unit

T

tot,old

= T

unit  min(1000/100, 100000/2000) 

= T

unit  min(10, 50) 

= 10 T

unit

T

tot,new

= ( T

unit /.8)  min[1000/(100.6), 100000/(20001.5)] 

= 1.25 T

unit  min[1000/60, 100000/3000] 

= 1.25 T

unit  min[16.67, 33.33] 

= 1.25 T

unit

= 1.25 T

unit

= 20 T

unit

20 T

unit

≥ 10 T

unit , so we should make the switch.

Problem #3. C  Assembly (CIO 3 aco)

The following C language function computes the integer square root, that is, given an

integer n ≥ 0, it returns the value r of the largest integer that is less than or equal to the

square root of n , or, in symbols,

r n

Design a correct implementation of this function in MIPS assembly language; that is,

hand-compile this C code to equivalent MIPS assembly. Use standard MIPS calling

conventions, except don’t worry about the frame pointer. Assume that an int is 32 bits.

Don’t worry about whether this particular algorithm does anything sensible when the

argument is negative (it doesn’t). It’s also not very efficient, but it works.

int sqrt(int n){ /* Find integer square root of n*/

int r=0; /* First trial square root = 0 */

while (rr <= n) / While it’s not too big, */

r++; /* keep making it bigger. */

return r-1; /* Too big, return previous. */

Please write neatly, comment your code, and draw a neat table showing any

correspondences that you may have set up between MIPS registers and C code variables.

sqrt: addi $v0, $zero, 0 # r := 0

loop: mul $t0, $v0, $v0 # $t0 := r*r

bgt $t0, $a0, end # if (r*r > n) goto end

addi $v0, $v0, 1 # r := r + 1

j loop # goto loop

end: addi $v0, $v0, -1 # r := r – 1

jr $ra # return with r-1 in $v

Notes: Since we don’t use any of the $s registers, and we don’t use jal,

and since the problem said not to worry about the frame pointer, we

don’t have to save/restore any registers on the stack. We use $a0 for

the argument n, and $v0 for the return value because these choices

are mandated by the standard MIPS calling conventions. To save

registers, we also use $v0 for the program variable r within the body of

the procedure.

Var. Reg.

n $a

r $v

r*r $t