Skip to content

Commit

Permalink
fix(selectOldest): use === instead of isNotBefore
Browse files Browse the repository at this point in the history
For instructions with vectors or other multiple `uop`, it is necessary to determine whether `robIdx` is the same before comparing `uopIdx`. Although there is no error if `isNotBefore` is used, we can use the clearer and more concise `===` to make the determination.
  • Loading branch information
Anzooooo committed Dec 9, 2024
1 parent ddf3803 commit 049386d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class LqExceptionBuffer(implicit p: Parameters) extends XSModule with HasCircula
}
val oldest = Mux(valid(0) && valid(1),
Mux(isAfter(bits(0).uop.robIdx, bits(1).uop.robIdx) ||
(isNotBefore(bits(0).uop.robIdx, bits(1).uop.robIdx) && bits(0).uop.uopIdx > bits(1).uop.uopIdx), res(1), res(0)),
(bits(0).uop.robIdx === bits(1).uop.robIdx && bits(0).uop.uopIdx > bits(1).uop.uopIdx), res(1), res(0)),
Mux(valid(0) && !valid(1), res(0), res(1)))
(Seq(oldest.valid), Seq(oldest.bits))
} else {
Expand All @@ -95,7 +95,7 @@ class LqExceptionBuffer(implicit p: Parameters) extends XSModule with HasCircula

when (req_valid) {
req := Mux(
reqSel._1(0) && (isAfter(req.uop.robIdx, reqSel._2(0).uop.robIdx) || (isNotBefore(req.uop.robIdx, reqSel._2(0).uop.robIdx) && req.uop.uopIdx > reqSel._2(0).uop.uopIdx)),
reqSel._1(0) && (isAfter(req.uop.robIdx, reqSel._2(0).uop.robIdx) || (req.uop.robIdx === reqSel._2(0).uop.robIdx && req.uop.uopIdx > reqSel._2(0).uop.uopIdx)),
reqSel._2(0),
req)
} .elsewhen (s2_enqueue.asUInt.orR) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/mem/lsqueue/StoreQueue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class StoreExceptionBuffer(implicit p: Parameters) extends XSModule with HasCirc
}
val oldest = Mux(valid(0) && valid(1),
Mux(isAfter(bits(0).uop.robIdx, bits(1).uop.robIdx) ||
(isNotBefore(bits(0).uop.robIdx, bits(1).uop.robIdx) && bits(0).uop.uopIdx > bits(1).uop.uopIdx), res(1), res(0)),
(bits(0).uop.robIdx === bits(1).uop.robIdx && bits(0).uop.uopIdx > bits(1).uop.uopIdx), res(1), res(0)),
Mux(valid(0) && !valid(1), res(0), res(1)))
(Seq(oldest.valid), Seq(oldest.bits))
} else {
Expand Down

0 comments on commit 049386d

Please sign in to comment.