1
\$\begingroup\$

This question already has an answer here:

I am trying to solve this problem, the answer should be 15/20 = 75%.

However, I am not sure how this was calculated and want to understand the underlying concept.

A program core consists of five conditional branches. The program core will be executed thousands of times. Below are the outcomes of each branch for one execution of the program core (T = taken, N = Not taken).

 Branch 1: T-T
 Branch 2: N-N-N
 Branch 3: T-N-T-N-T
 Branch 4: T-T-T-N
 Branch 5: T-T-N-T-T-T

This behavior remains the same. For dynamic schemes, assume each branch has its own prediction buffer and each buffer initialized to the same state before execution.

What is the prediction accuracy for the 2-bit predictor, initialized to weakly predict taken? (Answer is at the beginning but I'd like to understand the concept of the calculation.)

\$\endgroup\$

merged by Dave Tweed Oct 31 '14 at 12:08

This question was merged with 2-bit branch prediction accuracy because it is an exact duplicate of that question.