The GATE Grind

GATE 2015 CS (CS2) – Question 53

Computer Organization and Architecture · Instruction Pipelining and Pipeline Hazards · 2 marks · Numerical answer

A four-stage pipeline has IF (fetch/decode), OF (operand fetch), PO (perform operation), WB (writeback). IF,OF,WB take one cycle; PO takes one for ADD/SUB, three for MUL, five for DIV. PO-to-OF forwarding is available. Find the total cycles for:

MUL R5,R0,R1
DIV R6,R2,R3
ADD R7,R5,R6
SUB R8,R7,R4

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 13

Explanation

The first instruction enters PO in cycle three and occupies cycles three through five, then writes in six. DIV occupies PO in cycles six through ten. ADD obtains its dependent operands via forwarding and executes in eleven; SUB executes in twelve. Final writeback is in thirteen. Thus thirteen cycles suffice.

More Instruction Pipelining and Pipeline Hazards questions

All Instruction Pipelining and Pipeline Hazards questions →