GATE Computer ScienceHardGATE CS (PYQ pattern)
A 5-stage pipeline has forwarding from EX/MEM and MEM/WB to the ALU inputs and also from MEM/WB to the data input of a store in MEM. The program is: LW R1,0(R2); SW R1,4(R2); LW R3,8(R2); ADD R4,R3,R1; SW R4,0(R5). Including pipeline fill, how many cycles does it take to complete all 5 instructions?
- A. 9
- B. 12
- C. 11
- D. 10
Correct answer: D. 10
Ideal is 5 + 4 = 9. The SW after the first LW needs no stall (load data reaches the store data input via MEM-to-MEM forwarding), the ADD after the second LW needs one load-use stall, and the last SW gets R4 forwarded from the ALU: 9 + 1 = 10.
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- A process has three segments of 102,400 B (code), 61,440 B (data) and 20,780 B (stack). Each segment is allocated separately in whole…
- A 16 KB direct-mapped write-back cache has 32-byte blocks; every line stores its data, its tag, one valid bit and one dirty bit, and…
- In a 32-bit ripple-carry adder every full adder produces its carry-out 2 gate delays after its carry-in (inputs a and b are available at t…
- A classic 5-stage pipeline (IF, ID, EX, MEM, WB) runs: I1: ADD R1, R2, R3; I2: LW R4, 8(R1); I3: AND R5, R4, R1; I4: OR R6, R5, R4; I5: LW…
- A virtually indexed, physically tagged L1 cache has 64-byte blocks, 4 KB pages and must avoid synonym (aliasing) problems with no OS help…
- A disk spins at 6000 rpm with 500 sectors of 512 B per track and 4 recording surfaces. A long file fills whole cylinders in order…