GATE Computer ScienceHardGATE CS (PYQ pattern)

A nested loop's inner back-edge branch has the outcome pattern T T T T N (the inner loop runs 5 times) for each of 4 outer iterations (20 outcomes). A 2-bit saturating counter (taken predicted in states 2 and 3) starts in state 0. What is the misprediction count, and what is the count for a 1-bit last-outcome predictor starting at not-taken?

  1. A. 6 and 6
  2. B. 8 and 6
  3. C. 7 and 8
  4. D. 6 and 8

Correct answer: D. 6 and 8

2-bit: the first two T's are wrong (0→1→2); afterwards it stays in the taken half so only the 4 loop exits are wrong... = 6 total; 1-bit: first T wrong, each N wrong and the following T wrong: 1 + 4 + 3 = 8.

More Computer Organization and Architecture questions

Exams that ask this topic