GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A 5-stage pipeline resolves conditional branches in ID, with forwarding into ID for ALU results but the branch needs its operand at the start of ID. For LW R1,0(R2) followed immediately by BEQ R1,R3,L, how many stall cycles does the branch suffer (before any branch-penalty from fetching the next instruction)?
- A. 2
- B. 1
- C. 0
- D. 3
Correct answer: A. 2
The loaded value is only available at the end of MEM; the branch compares it in ID, so it must wait until the load has passed MEM and the value is forwarded: 2 stall cycles (1 if the branch were resolved in EX).
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- A branch alternates T, N, T, N, … for 20 executions, starting with T. A 2-bit saturating counter (states 0-3, predicts taken in states 2…
- A 5-stage pipeline with full forwarding has a measured CPI of 1.40 (ideal 1). 25% of instructions are loads, and 40% of loads are…
- A disk spins at 6000 rpm and each track holds 256 KB. A 1 MB file is stored on 4 consecutive tracks of the same cylinder-group; a head…
- Over 1000 memory references, 40 miss in L1 and 20 of those also miss in L2. L1 hit time is 1 cycle, L2 hit time 10 cycles, and memory adds…
- Radix-2 Booth recoding of an 8-bit multiplier performs one add or subtract at each change between adjacent bits (with an implied 0 to the…
- A pipeline with ideal CPI 1 handles branches (frequency 20%, of which 40% are taken) in one of three ways: (a) stall for 3 cycles on every…