Professional Documents
Culture Documents
Answer Sheet:
Q1: (a) (b) (c) (d)
A: 3 seconds 500 6 2
(a) (b)
instruction 2 instruction 7
(a)
0x01A0582A 0x1540FFF9
$s0 $t5
Q4: (b)
70 30
1
Question #1: [1.5 x 4 = 6 points]
The table below lists the running frequency and CPI of different instruction types for three processors: P1,
P2, and P3.
Processor P1 P2 P3
Frequency 1 GHz 2 GHz 3 GHz
CPI of type A 2 3 4
instructions
CPI of type B instructions 4 5 6
CPI of type C instructions 4 5 X
The three processors are to run the same program which contains 1 Billion dynamic instructions. The
instruction mix of the program is as follows:
Instruction Type Fraction
Type A 50%
Type B 30%
Type C 20%
(a) Find the execution time in seconds of the program when run on processor P1.
(b) Find the MIPS (million instructions per second) of processor P2 when running the program.
(c) The CPI of processor P3 when running the above program is 5.0, find the value of X.
(d) The execution time of the whole program on processor P1 is to be sped up by a factor of 1.25 by
improving the CPI of type B instructions alone. Find the new CPI of type B instructions for processor
P1 to accomplish this.
(a) Represent (-20.25)10 using the FP format above. (Write your result in hexadecimal)
(c) What is the smallest positive number that can be represented? (write your result in decimal)
(d) What is the largest possible number that can be represented? (write your result in decimal)
2
Question #3: [3 x 2 = 6 points]
For each of the following pseudoinstructions, write a minimal sequence of MIPS instructions that
accomplish the same thing. You can only use the MIPS core instructions listed in the left column of Page 4
of this exam. The minimal number of instructions needed is given in parenthesis.
(a) swapm $t0, $t1 swaps the contents of the memory locations M[$t0] and M[$t1] (4 instructions)
(a) Encode the following instructions into MIPS binary code: (Write your result in
hexadecimal) instruction 2, instruction 7.
1 word
(b) What will the contents of the following registers be at the end of the execution
of the program segment: $s0, $t5
(c) If a processor requires 1 cycle to execute any instruction. How many cycles are
needed to execute the code segment above?
(d) Instruction 7 above was replaced by a new instruction with the following encoding: 0x1000FFFF, find
the new number of cycles needed to execute the whole modified code segment?