提交 351914a5 编写于 作者: L Lingrui98

ftq: fix a bug of unexpectedly set all commit status to invalid

* when a replay redirect comes straight after a mispredict redirect
  of the same ftqIdx, the ifuWbPtr is exactly idx+1, while the previous
  implementation of method 'set_status_between' set all status in
  such case
上级 99b08ffe
......@@ -37,6 +37,9 @@ object FtqPtr {
ptr.value := v
ptr
}
def inverse(ptr: FtqPtr)(implicit p: Parameters): FtqPtr = {
apply(!ptr.flag, ptr.value)
}
}
class FtqNRSRAM[T <: Data](gen: T, numRead: Int)(implicit p: Parameters) extends XSModule {
......@@ -428,9 +431,9 @@ class Ftq(implicit p: Parameters) extends XSModule with HasCircularQueuePtrHelpe
require(status_vec.length == FtqSize)
XSError(isAfter(from, to), "in set_status_between, \'from\' must be not after \'to\'\n")
for (i <- 0 until FtqSize) {
val wen = Mux(from.value < to.value,
i.U >= from.value && i.U < to.value,
i.U >= from.value || i.U < to.value) // when from.value === to.value, all entry is set
val wen = (from.value < to.value && i.U >= from.value && i.U < to.value) ||
(from.value > to.value && i.U >= from.value || i.U < to.value) ||
(from.flag =/= to.flag)
when (wen) {
status_vec(i) := status
}
......@@ -750,7 +753,7 @@ class Ftq(implicit p: Parameters) extends XSModule with HasCircularQueuePtrHelpe
commitStateQueue(next.value).foreach(_ := c_invalid)
}
}
set_replay_status_between(ifuPtr, ifuPtr, l_invalid) // set all to invalid
set_replay_status_between(ifuPtr, FtqPtr.inverse(ifuPtr), l_invalid) // set all to invalid
loadReplayOffset.valid := false.B
// load replay
}.otherwise {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册