Given the following loop code segment, draw the pipeline diagram in the table by filling the stages
Question:
Given the following loop code segment, draw the pipeline diagram in the table by filling the stages and stalls, and mark the data forwarding. How many cycles are there between two successive stores of F4 in the loop? Consider there is no branch prediction.
Loop: ld F0, 0(R1) // 1-cycle latency, F0 <- memory[ R1 + 0 ]
addf F4, F2,F0 // 3-cycle latency, F4 <- F2 + F0
st F4, 0(R1) // 1-cycle latency, memory[ R1 + 0 ] <- F4
ld F6, 8(R1) // 1-cycle latency, F6 <- memory[ R1 + 8 ]
addf F8, F6,F0 // 3-cycle latency, F8 <- F6 + F0
st F8, 8(R1) // 1-cycle latency, memory[ R1 + 8 ] <- F8
sub R1, R1, 16 // 0-cycle latency, R1 <- R1 - 16
bne R1, R2, loop // 0-cycle latency, branch to loop if R1 != R2