Predict whether the branch at `pc` will be taken and what its target will be. Returns `(predicted_taken, predicted_target)`.
(&self, pc: u64)
| 45 | pub fn predict(&self, pc: u64) -> (bool, u64) { |
| 46 | let taken = self.pht[Self::pht_idx(pc)] >= 2; |
| 47 | let target = self.btb.get(&pc).copied().unwrap_or(pc.wrapping_add(4)); |
| 48 | (taken, target) |
| 49 | } |
| 50 | |
| 51 | /// Update the predictor with the actual outcome of a branch at `pc`. |
| 52 | /// Call this once per branch instruction as it exits the EX stage. |
| 53 | pub fn update(&mut self, pc: u64, was_taken: bool, actual_target: u64, predicted_taken: bool) { |
| 54 | let idx = Self::pht_idx(pc); |