GATE Computer ScienceVery hardNIELIT Scientist B

A branch is executed 20 times with the outcome pattern T, T, T, N repeated 5 times. A 2-bit saturating counter (states 0–3, predicts taken when the state is 2 or 3, incremented on T, decremented on N) starts at state 0. How many mispredictions occur?

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

Correct answer: D. 7

The cold counter mispredicts T, T and N in the first round (3 misses), then it stays in states 2-3 and mispredicts only each N in the other 4 rounds, so the total is 7.

More Computer Organization and Architecture questions

Exams that ask this topic