Case of NO BTB
- ideal CPI Is 1
- + stalls
- we can just look at stalls and forget everything else
- 1 + f(branch) * 3

With BTB
- 1 + stalls
- we have our BTB and the first question is “is it a hit or not”
- no:
→ f(branch) * 1 - BTB hit rate * BMP
→ we have a buffer miss penalty (BMP) too
- yes:
→ f(branch) * BTB hit rate
→ is branch taken?
⇒ yes: penalty = 0. we are a happy bunny
⇒ no: 1 - Accuracy * (1 + BMP)
- in both cases, only the branch instructions are involved
- so we can cancel out the 1 and the fbranch since they appear on both sides
- so then we have BTB hit rate
- when we get to the branch not taken, what is the penalty?
- It is the buffer miss penalty + 1

that gives us this equation:
f(branch) * (1 - BTB hit rate) * (BMP) + f(branch) * (BTB hit rate) * (1 - Acc) ( 1 + BMP) = f(branch) * 3
can factor out f(branch)
(1 - BTB hit rate) * (BMP) + (BTB hit rate) * (1 - Acc) ( 1 + BMP) = 3
(0.25) * (BMP) + (0.75) * (1 - Acc) ( 1 + BMP) = 3

Acc = 1 - [ (3-0.25BMP) / (0.75(1+BMP) ]
if BMP = 3, acc is 25%
this is the minimum accuracy
if we put 1 or 2 the accuracy will be negative
3 is the minimum BMP s.t. accuracy is positive

Index