Assume that the following code is executed on a five stage p

Assume that the following code is executed on a five stage pipeline data path: add $5, $2, $1 1w $3, 4($5) 1w $2, 0($2) or $3, $5, $3 sw $3, 0($5) and $7, $8, $2 a. If there is no forwarding and hazard detection unit, insert NOPs in the code to ensure correct operation. How many clock cycles are needed to finish this set of instructions? b. Repeat part (a) with this assumption that you can change or rearrange the instructions, and the only register that you can use in addition to the above registers is $6. How many clock cycles you will need in this case? What is the speed up compare to part (a). Now assume that we have the forwarding unit in the design, but we don\'t have the hazard detection unit. What happens when this code is being executed? Explain your answer.

Solution

(a)

add $5,$2,$1

nop

nop

lw $3,4($5)

lw $2,0($2)

or $3,$5,$3

nop

nop

sw $3,0($5)

and $7,$8,$2

10 clock cycles are needed to finish the set of instruction

 Assume that the following code is executed on a five stage pipeline data path: add $5, $2, $1 1w $3, 4($5) 1w $2, 0($2) or $3, $5, $3 sw $3, 0($5) and $7, $8,

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site