HW 5
HW 5
1. Suppose you wish to run a program P with 7.5 × 109 instructions on a 5GHz machine with a CPI of
0.8. What is the expected CPU time?
2. For the following set of variables, identify all of the subsets that can be used to calculate execu-
tion time. Each subset should be minimal (i.e., it should not contain any unnecessary variables.
CP I, clockrate, cycletime, numberof instructionsinprogram, numberof cyclesinprogram
3. Show how to add the linc (“load increment”) instruction to the single-cycle MIPS processor. Start
from the base processor implementation shown on the last page of this assignment. This instruction
corresponds to the following sequence of two instruction: lw $rt, L($rs) then addi $rs, $rs, 1.
Add all necessary datapaths and control signals to the processor.
4. Show how to implement the instruction swap $rs, $rt, which swaps the contents of registers $rs and
$rt. As before, start your design from a clean base processor.
5. One could always have executed two instructions to carry out the swap operation. Call this the software
implementation of swap. Imagine your hardware implementation of swap (from the previous problem)
increased the clock period by 10%. What percentage of swap operations in the instruction mix would
make it worthwhile to implement in hardware rather than using the two software instructions?
1
Datapath:
R-type 000000 1 1 0 0 0 0 10
lw 100011 1 0 1 0 0 0 00
sw 101011 0 X 1 0 1 X 00
beq 000100 0 X 0 1 0 X 01
Control (ALU Decoder):