Solution :
Given :
a). ADD
LW
LW
OR
Without forwarding
Only the RAW dependencies can cause data hazards.
The dependencies are :
RAW dependency between instruction 1 and 2 on R1
RAW dependency between instruction 1 and 3 on R1
RAW dependency between instruction 3 and 4 on R1
RAW dependency between instruction 2 and 4 on R2
With forwarding
The result after the execution phase of first instruction is forwarded to second instruction.
So there would not be any dependencies among instruction 1 and 2 and also 1 and 3.
With forwarding the RAW dependencies that can exit only from load to next instruction.
So the dependencies that exit is only between 3 and 4.
The dependencies are RAW dependencies between instruction 3 and 4 on R1.
b). LW
AND
LW
LW
Only RAW dependencies can cause data hazards
The dependencies are
RAW dependency between instruction 1 and 2 on R1
RAW dependency between instruction 1 and 3 on R1
RAW dependency between instruction 2 and 3 on R1
With forwarding
The result after the execution phase of second instruction is forwarded to third instruction.
So there won't be RAW dependencies among instruction 2 and 3.
With forwarding the RAW dependencies that can exist only from load to next instruction.
So dependencies that exists is only between 1 and 2.
Therefore dependencies are RAW dependency between instruction 1 and 2 on R1.