Tuesday, April 8, 2014

Branch Target buffer

Problem

What is a Branch Target buffer? Explain how it can be used in reducing bubble cycles in cases of branch misprediction.

Solution

Branch misprediction occurs when the CPU mispredicts the next instruction to be executed.

The CPU uses pipelining which allows several instructions to be processed simultaneously. But during a conditional jump, the next instruction to be executed depends on the result of the condition. Branch Prediction tries to guess the next instruction. However, if the guess is wrong, we are penalized because the instruction which was executed must be discarded.

Branch Target Buffer (BTB) reduces the penalty by predicting the path of the branch, computing the target of the branch and caching the information used by the branch. There will be no stalls if the branch entry found on BTB and the prediction is correct, otherwise the penalty will be at least two cycles.

Reference
http://tianrunhe.wordpress.com/2012/04/20/branch-target-buffer/

Reactions:

0 comments:

Post a Comment