GATE 2010 CS (CS1) – Question 43
A pipeline has IF, ID, OF, PO and WO stages. IF, ID, OF and WO each take one cycle. PO takes one cycle for ADD/SUB, three for MUL and six for DIV. Operand forwarding is available. Find the cycles needed for:
I0: MUL R2,R0,R1 ; R2=R0*R1
I1: DIV R5,R3,R4 ; R5=R3/R4
I2: ADD R2,R5,R2 ; R2=R5+R2
I3: SUB R5,R2,R6 ; R5=R2-R6Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) 15
Explanation
I0 enters PO in cycle four and occupies cycles four through six. The single PO stage then executes I1 during cycles seven through twelve. Forwarding supplies its result to I2 in cycle thirteen; I3 executes in fourteen. Its WO finishes in cycle fifteen. Thus B; forwarding avoids additional waiting for register writeback.