GATE Computer ScienceHardGATE CSE

A 5-stage pipeline (IF, ID, EX, MEM, WB) has no forwarding; the register file is written in the first half of a cycle and read in the second half. Instructions: I1: ADD R1,R2,R3; I2: SUB R4,R1,R5; I3: AND R6,R4,R1; I4: OR R7,R2,R3; I5: XOR R8,R6,R7. The pipeline stalls in ID until operands are available, and instructions issue in order. How many clock cycles pass from the first fetch until I5 completes WB?

  1. A. 15
  2. B. 12
  3. C. 17
  4. D. 9

Correct answer: A. 15

I2 reads R1 only in I1's WB cycle (5), finishing at 8; I3 waits for I2's WB (8), finishing at 11; I4 reads at 9 (WB 12); I5 waits for I4's WB at 12 and completes at 15.

More Computer Organization and Architecture questions

Exams that ask this topic