Overview

In deeply pipelined processors, the outcome of a conditional branch might not be known for many cycles. Branch prediction allows the CPU to keep the pipeline full by guessing the outcome and fetching instructions from the predicted path.

Types

  • Static Prediction: Simple rules (e.g., always assume a backward branch is taken).
  • Dynamic Prediction: Uses historical data to make guesses (e.g., Branch Target Buffer, Pattern History Table).

Misprediction Penalty

If the guess is wrong, the CPU must flush the pipeline and restart execution from the correct path, which wastes time and energy.

Related Terms