GATE Computer ScienceVery hardGATE CS (PYQ pattern)
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 ID only in the next 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 R1, 0(R9); I2: LW R2, 4(R9); I3: ADD R3, R1, R2; I4: BEQ R3, R0, L2; I5: SUB R4, R3, R1; I6: ADD R5, R4, R2; I7 (label L2): SW R5, 8(R9). The BEQ is taken. In which cycle does the last instruction finish WB?
- A. 23
- B. 15
- C. 20
- D. 17
Correct answer: D. 17
A consumer's ID must come at least 4 cycles after its producer's ID (one cycle after the WB). ID cycles: I1 2, I2 3, I3 7, I4 11, I7 14. I4 waits for R3; the taken branch skips I5 and I6, so the SW only waits for the redirect (branch ID + 3) and uses the old R5. WB = 17. Not taken, the chain I5 → I6 → I7 gives 23; with a split-cycle register file it would be 15.
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- 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…
- A control unit has 48 control signals partitioned into 6 groups of mutually exclusive signals of sizes 12, 10, 9, 8, 5 and 4. In a…
- A branch outcome stream is TTTTTNN repeated 6 times (42 outcomes). With a 2-bit saturating counter (taken predicted in states 2,3)…
- A direct-mapped cache has 2 lines of 4 words each. A program writes (once each) to word addresses 0, 4, 8, 12, 16, 20, 24, 28 and never…