Indicate data dependency in the code below Assuming there is
Indicate data dependency in the code below. Assuming there is no forwarding in the pipeline, howmany clock cycles are needed to finish the program? If full forwarding is used, howmany clock cycles are needed?
a) lw $1, 40($6)
add $6, $2, $2
sw $6, 50($1)
b) lw $5, -16($5)
sw $5, -16($5)
add $5, $5, $5
c) lw $1, 60($2)
add $2, $3, $3
add $1, $2, $2
sw $1, -16($2)
Solution
1. $1 in Instr.(3) has data dependency with instr.(1)
2. $6 in Instr.(3) has data dependency with instr.(2)
3. $6 in Instr.(4) has data dependency with instr.(2)
==========================================================================