With the increase in the number of pipeline stages, change of flow (COF) become more costly to the processor’s performance due to the increased number of pipeline flushes and stalls. Branch Target Buffer(BTB) mitigates these stall and flush cycles . COF works differently with and without BTB.
The below table provides information on the number of stalls with and without BTB when a branch occurs.
Branch |
Condition |
Target Prediction |
Stalls with BTB (Non-delayed branch/delayed branch) |
Maximum # of stalls without BTB (Non-delayed branch/delayed branch) |
|
Prediction |
Actual |
||||
Conditional |
Taken |
Taken |
Correct |
2/0 |
11/9 |
Conditional |
Not Taken |
Not-Taken |
— |
0 |
5 |
Conditional |
Taken |
Not-Taken |
— |
11 |
11/9 |
Conditional |
Not Taken |
Taken |
— |
11/9 |
11/9 |
Conditional |
Taken |
Taken |
Incorrect |
6/4 |
11/9 |
Unconditional |
— |
— |
Correct |
2/0 |
6/4 |
Unconditional |
— |
— |
Incorrect |
6/4 |
6/4 |