GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Two branches share one 2-bit saturating counter (aliasing in a small predictor table): X is always taken, Y is never taken, and they execute alternately X, Y, X, Y, … for 20 dynamic branches. The counter predicts taken in states 2 and 3 and starts in state 2. How many mispredictions occur with the shared counter, and how many in total with two private counters that also start in state 2?

  1. A. 10 shared; 1 private
  2. B. 10 shared; 0 private
  3. C. 10 shared; 10 private
  4. D. 20 shared; 1 private

Correct answer: A. 10 shared; 1 private

Shared: the counter is pushed down by each Y and up by each X, so it only moves between states 2 and 3, always predicts taken, and every Y (10 of them) is mispredicted. Private counters: X's counter stays at 3 (no misses); Y's starts at 2 and is wrong once (then 1, 0, …): total 1.

More Computer Organization and Architecture questions

Exams that ask this topic