Exercise 4.13
In this exercise, we examine how data dependencies affect execution in the basic 5-stage pipeline
described in Section 4.5. Problems in this exercise refer to the following sequence of instructions:
Instruction Sequence
a. SW R16, -100(R6)
LW R4, 8(R16)
ADD R5, R4, R4
b. OR R1, R2, R3
OR R2, R1, R4
OR R1, R1, R2
Without Forwarding With Full Forwarding With ALU-ALU Forwarding Only
a. 250 ps 300 ps 290 ps
b. 180 ps 240 ps 210 ps
4.13.4 [10] <4.5> What is the total execution time of this instruction sequence without forwarding and
with full forwarding? What is the speedup achieved by adding full forwarding to a pipeline that had no
forwarding?
4.13.5 [10] <4.5> Add NOP instructions to this code to eliminate hazards if there is ALU-ALU forwarding
only (no forwarding from the MEM to the EX stage).
4.13.6 [10] <4.5> What is the total execution time of this instruction sequence with only ALU-ALU
forwarding? What is the speedup over a no-forwarding pipeline?
Exercise 4.13
In this exercise, we examine how data dependencies affect execution in the basic 5-stage pipeline
described in Section 4.5. Problems in this exercise refer to the following sequence of instructions:
Instruction Sequence
a. SW R16, -100(R6)
LW R4, 8(R16)
ADD R5, R4, R4
b. OR R1, R2, R3
OR R2, R1, R4
OR R1, R1, R2
Without Forwarding With Full Forwarding With ALU-ALU Forwarding Only
a. 250 ps 300 ps 290 ps
b. 180 ps 240 ps 210 ps
4.13.4 [10] <4.5> What is the total execution time of this instruction sequence without forwarding and
with full forwarding? What is the speedup achieved by adding full forwarding to a pipeline that had no
forwarding?
a.
a. No forwarding: 5 × 250ps = 1250ps; full-forwarding: 4 × 300ps = 1200ps;
1250ps
1200ps
=
1.04 𝑡𝑖𝑚𝑒𝑠 𝑓𝑎𝑠𝑡𝑒𝑟
b. No forwarding: 7 × 250ps = 1750ps; full-forwarding: 3 × 300ps = 900ps;
1750ps
900ps
=
1.94 𝑡𝑖𝑚𝑒𝑠 𝑓𝑎𝑠𝑡𝑒𝑟
b.
a. No forwarding: 5 × 180ps = 900ps; full-forwarding: 4 × 240ps = 960ps;
900ps
960ps
=
.94 𝑡𝑖𝑚𝑒𝑠 𝑎𝑠 𝑓𝑎𝑠𝑡
b. No forwarding: 7 × 180ps = 1260ps; full-forwarding: 3 × 240ps = 720ps;
1260ps
720ps
=
1.75 𝑡𝑖𝑚𝑒𝑠 𝑓𝑎𝑠𝑡𝑒𝑟
4.13.5 [10] <4.5> Add NOP instructions to this code to eliminate hazards if there is ALU-ALU forwarding
only (no forwarding from the MEM to the EX stage).
a. SW, LW, NOP, NOP, ADD
b. OR, OR, OR
4.13.6 [10] <4.5> What is the total execution time of this instruction sequence with only ALU-ALU
forwarding? What is the speedup over a no-forwarding pipeline?
a.
a. 5 × 290ps = 1450ps;
1250ps
1450ps
= 0.86 𝑡𝑖𝑚𝑒𝑠 𝑎𝑠 𝑓𝑎𝑠𝑡
b. 3 × 290ps = 870ps;
1750ps
870ps
= 2.01 𝑡𝑖𝑚𝑒𝑠 𝑓𝑎𝑠𝑡𝑒𝑟
b.
a. 5 × 210ps = 1050ps;
900ps
1050ps
= 0.86 𝑡𝑖𝑚𝑒𝑠 𝑎𝑠 𝑓𝑎𝑠𝑡
b. 3 × 210ps = 630ps;
1260ps
630ps
= 2 𝑡𝑖𝑚𝑒𝑠 𝑓𝑎𝑠𝑡𝑒𝑟