Skip to content

Fixed updates of the bht on correct not_taken prediction

Eclipse Webmaster requested to merge github/fork/OttG/bht_update_fix into master

Created by: OttG

This fix sets the cf_type of resolved_branch_o as Branch when a branch not taken is predicted correctly. On the current master of CVA6 the following scenario works as following:

  • In the frontend when a branch is predicted as not taken sets cf_type to NoCF;
  • When the branch is arrives into the branch_unit if the prediction was correct the cf_type of resolved_branch_o is left as NoCF;
  • The branch resolution is sent back to the frontend and given that cf_type is not Branch the valid of bht_update is left to 0 (line 260).

This means that in case of a correct branch prediction where the branch is not taken the entry that refers to that branch will have the saturation counter updated. This does not seem like an update policy of the predictor (e.g. we only update the predictor on misprediction) because on the scenario where a branch is taken and predicted in a correct way the cf_type of resolved_branch_o will be set as Branch (in the branch unit) which then is forwarded to the frontend where this time the valid of bht_update is set to 1. This means a correctly predicted branch taken updates the BHT while a correctly predicted branch not taken does not.

The fix consists into setting the value of cf_type of resolved_branch_o in the branch_unit to Branch whenever a valid branch arrives. For the signal is_mispredicted we have the comparison of the ALU with the prediction from the frontend.

Signed-off-by: Gianmarco Ottavi gianmarco@openhwgroup.org

Merge request reports

Loading