# Understanding processor instruction pipeline problem solution

I need help in understanding the solution from solution manual.
The question is from the exercise 4.13.5 of chapter 4 in the book Computer Organization and Design by Patterson and Hannessey (4th edition).
The question is about instruction pipelining.

The question

Consider two instruction sequences:

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).

The solution from solution manual

With ALU-ALU-only forwarding, an ALU instruction can forward to the next instruction, but not to the second-next instruction (because that would be forwarding from MEM to EX). A load cannot forward at all, because it determines the data value in MEM stage, when it is too late for ALU-ALU forwarding. We have:

Doubts

1. The question asks to add NOPs. But I dont see single NOP in the solution given.

2. In the solution it says "A load cannot forward at all, because it determines the data value in MEM stage, when it is too late for ALU-ALU forwarding.". Then how there can be "ALU-ALU forwarding of R4 from I2" in isntruction sequence 1?

3. I dont get the meaning of the question itself. Does it mean to replace ALU-ALU forwarding with NOPs and keep MA-EX forwarding untouched?

4. This link gives solution to 2nd instruction sequence as follows:

while this chegg link gives its solution as follows:

Whats true?

(There are other resources giving other instruction sequences, like ppts and pdf from different university courses, but none of them give satisfactory logical solution. I did not give them here to avoid further confusion.)

• Reading this question again, it says "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)." It says "if there is ALU-ALU forwarding only", so does that mean we shouldnt be bothered about problem with LW since it requires MEM-ID forwarding? and we should only think of instruction sequence (b)? – anir123 Jun 26 '17 at 9:13