Nios® V Processor Reference Manual

ID 683632
Date 10/07/2024
Public
Document Table of Contents

4.3.12. Branch Prediction

Nios® V/g processor core supports Static Branch Prediction. This core implements Backward Taken, Forward Not Taken (BTFN) mechanism. This technique is a simple form of branch prediction because it does not rely on the history of the branches. It predicts the outcome of a branch instruction as follows:
  • Always taken, when backward branches, or
  • Always not taken when forward branches.
The processor core determines the type of branches by comparing the Program Counter and targeted branch address (branch PC).
  • Backward branch - When the target branch address is less than the Program Counter.
  • Forward branch - When the target branch address is greater than the Program Counter.
For example, the assembly code below shows a forward branch. ef0 is the Program Counter, and f10 is the targeted branch address. Since the targeted branch address is greater than the Program Counter, the processor core does not take the branch.
Figure 12. Branch Prediction
Note: Enabling branch prediction can improve the core performance (such as the Dhrystone and CoreMark benchmark), but it may also increase logic resource utilization.