GATE Computer ScienceModerateGATE CS (PYQ pattern)

A loop body is LW, ADD (uses the loaded value), SW, ADDI, BNE and runs 1000 times on a 5-stage pipeline with forwarding: the ADD right after the LW stalls 1 cycle and each taken BNE costs 2 flush cycles. The loop is unrolled twice (500 iterations of LW, LW, ADD, ADD, SW, SW, ADDI, BNE), with the loads scheduled so that no load-use stall remains; the BNE is still taken in every iteration. Ignoring pipeline fill, what is the speed-up of the unrolled loop?

  1. A. 1.25
  2. B. 2.00
  3. C. 1.60
  4. D. 1.45

Correct answer: C. 1.60

Original: 5 instructions + 1 stall + 2 flush = 8 cycles × 1000 = 8000. Unrolled: 8 instructions + 0 stalls + 2 flush = 10 cycles × 500 = 5000. Speed-up 8000/5000 = 1.60. Counting instructions only (5000 vs 4000) gives 1.25.

More Computer Organization and Architecture questions

Exams that ask this topic