Skip to content

Commit

Permalink
fix(RAS): adjust the signal judgment of isCall and isRet during redir…
Browse files Browse the repository at this point in the history
…ection (OpenXiangShan#4232)

If the instruction is invalid, the corresponding pre-decoding
information should be 0. Because when the IFU module detects a
prediction error, the misOffset issued may not correspond to a valid
instruction.
  • Loading branch information
my-mayfly authored Jan 27, 2025
1 parent 4ba1d45 commit d139422
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/xiangshan/frontend/newRAS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ class RAS(implicit p: Parameters) extends BasePredictor {
val do_recover = redirect.valid
val recover_cfi = redirect.bits.cfiUpdate

val retMissPred = do_recover && redirect.bits.level === 0.U && recover_cfi.pd.isRet
val callMissPred = do_recover && redirect.bits.level === 0.U && recover_cfi.pd.isCall
val retMissPred = do_recover && redirect.bits.level === 0.U && recover_cfi.pd.isRet && recover_cfi.pd.valid
val callMissPred = do_recover && redirect.bits.level === 0.U && recover_cfi.pd.isCall && recover_cfi.pd.valid
// when we mispredict a call, we must redo a push operation
// similarly, when we mispredict a return, we should redo a pop
stack.redirect_valid := do_recover
Expand Down

0 comments on commit d139422

Please sign in to comment.