


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!



EEL 4713/5764, Spring 2006 – Computer Architecture
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.
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:
tot,new
tot,old
Within the cost and power constraints,
tot,old
unit min( P max
unit
max
unit
tot,new
unit /80%) min[ P max
unit
max
unit
Thus, the overall inequality that must be satisfied to make the switch
is:
unit /80%) min[ P max
unit
max
unit
unit min( P max
unit
max
unit
If we like, we can also cancel out T unit and simplify slightly to:
1.25 min[ P max
unit
max
unit )] ≥ min( P max
unit
max
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.
max
max
unit
unit
tot,old
unit min(1000/100, 100000/2000)
unit min(10, 50)
unit
tot,new
unit /.8) min[1000/(100.6), 100000/(20001.5)]
unit min[1000/60, 100000/3000]
unit min[16.67, 33.33]
unit
unit
unit
unit
unit , so we should make the switch.
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