GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A classic 5-stage pipeline (IF, ID, EX, MEM, WB) has full forwarding (EX/MEM and MEM/WB to the ALU inputs), so only a load followed immediately by a user of its result stalls, for one cycle. Branches are resolved in EX; a taken branch flushes the two instructions fetched after it and the target is fetched in the next cycle. Without hazards I1 finishes WB in cycle 5. Program: I1: LW R2, 0(R1); I2: ADD R3, R2, R2; I3: LW R4, 4(R1); I4: ADD R5, R4, R3; I5: BEQ R5, R6, L4; I6: LW R7, 0(R5); I7: ADD R8, R7, R5; I8 (label L4): SUB R9, R8, R5. The BEQ is taken. In which cycle does the last instruction finish WB?
- A. 14
- B. 15
- C. 18
- D. 16
Correct answer: A. 14
Load-use bubbles after I1 and I3; ID cycles I1 2, I2 4, I3 5, I4 7, I5 8, I8 11. The taken branch skips I6 and I7, so I8 (whose R8 is just the old value) is fetched after the branch resolves: ID 11, WB 14. Not taken, I6 → I7 adds another load-use bubble and the last WB is 15; without forwarding it would be 18.
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- A write-through, no-write-allocate data cache sends every store to memory. 10% of instructions are stores and 20% are loads (load miss…
- A zero-address stack machine evaluates the expression (a + b) × (c + d) + (e + f) × (g + h) with every operator commutative, so the…
- A classic 5-stage pipeline (IF, ID, EX, MEM, WB) has no forwarding and no split-cycle register file: a value written in WB can be read in…
- A memory has 8 low-order interleaved banks (bank = address mod 8). A bank is busy for 6 cycles after starting an access; the processor can…
- An accumulator machine has memory contents M[100]=300, M[104]=7, M[150]=75, M[200]=150, M[300]=500 and registers R1 = 100, R2 = 4…
- A loop branch is taken 9 times and then falls through (T×9, N), and the whole 10-outcome pattern repeats 5 times. A 2-bit saturating…