Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Consider the following MIPS program: ADDI R1, R0, #1 SW R1, 2000 (R0) LOOP: L

ID: 663584 • Letter: 1

Question

1) Consider the following MIPS program:

ADDI R1, R0, #1

SW R1, 2000 (R0)

LOOP: LW R1, 2000 (R0)

MULT R2, R1, #4

ADDI R3,R2, #5000

LW R4, 0 (R3)

LW R5, 1500 (R0)

ADD R6, R4, R5

LW R1, 2000 (R0)

MULT R2, R1, #4

ADDI R7, R2, #0

SW R6, 0(R7)

LW R1, 2000 (R0)

ADDI R1, R1, #1

SW R1, 2000 (R0)

LW R1, 2000 (R0)

ADDI R8, R1, #-101

BNEZ R8, LOOP

a) What is the value of IC for this program?

b) What is the fraction of ALU instructions?

c) What is the fraction of Loads/Store instructions?

d) What is the fraction of Branch instructions?

e) Assume ALU, Loads/Stores, and Branch instructions require one, two, and three clock cycles respectively. Find CPI.

f) Assuming the previous parts and 2 ns clock cycles, what is the execution time of this program?

Explanation / Answer

a)IC=Total Instructions executed

b) Fraction of ALU instructions =ALU instructions executed / Total inst. Executed

c) Fraction of Loads/Store instructions=Load/Store instructions executed / Total inst. Executed

d) fraction of Branch instructions=Branch instructions executed / Total inst. Executed

e)CPI = CPU execution cycles / Instructions count

f)CPU time = Instruction count x CPI / Clock rate