Professional Documents
Culture Documents
Homework 7
Due Date: 11/07/2012 in class
1. Assume that the following sequence of instructions is executed on a 5-stage pipelined
datapath:
1
2
3
4
5
ADD R5,R2,R1
LW R3,4(R5)
LW R2,0(R2)
OR R3,R5,R3
SW R3,0(R5)
D
F
1 ADD R5,R2,R1
2 LW R3,4(R5)
E
D
F
#
#
#
#
#
#
#
#
3 LW R2,0(R2)
4 OR R3,R5,R3
5 SW R3,0(R5)
R5
R5
R3
No
R3
R3
R3
R5
M
NOP
NOP
W
NOP
NOP
E
D
F
M
E
D
F
W
M
NOP
NOP
W
E
D
M
NOP
W
NOP
ADD R5,R2,R1
NOP
NOP
LW R3,4(R5)
LW R2,0(R2)
NOP
OR R3,R5,R3
NOP
NOP
SW R3,0(R5)
b) If there are forwarding and hazard detection units implemented, indicate the
instructions where forwarding is required to eliminate NOPs.
1
2
3
4
5
ADD R5,R2,R1
LW R3,4(R5)
LW R2,0(R2)
OR R3,R5,R3
SW R3,0(R5)
D
F
E
D
F
M
E
D
F
W
M
E
D
F
W
M
E
D
W
M
E
W
M
Name:
2. Consider the following instructions being executed in pipelined MIPS processor and treat
them separately:
i.
ii.
SW R16, -100(R6)
OR R2, R1, R0
a) As the instruction executes, what is kept in the pipeline registers in each stage?
b) Which registers are read?
c) What does the instruction do in each stage of the pipeline?