Indicate the type of data hazards (RAW, WAR, and WAW) that exist between the following instructions:
I1:ADD R1, R2, R3 ; R1 = R2 + R3
I2:ADD R4, R1, R4 ; R4 = R1 + R4
I3:ADD R3, R1, R2 ; R3 = R1 + R2
I4:ADD R1, R1, R4 ; R1 = R1 + R4
Soln: Between I1 and I2 RAW(w.r.t. R1),
In I2 WAW (w.r.t R4 but I am not sure if this has WAR too)
Between I3 and I4 WAR (w.r.t. R1)
In I4 WAW (w.r.t R1 but I am not sure if this has WAR too)
Please correct me and My doubts, as follows:
i)Whether hazards can exist in single instruction?(as in I2 and I4)
ii)Do we have to consider only consecutive instructions? (as in I1 and I2) or can it be (I1 and I3) too?