未验证 提交 75b25016 编写于 作者: Y Yinan Xu 提交者: GitHub

rob: fix the allowEnqueue condition (#1664)

This commit fixes the allowEnqueue condition of ROB. We should always
consider the enqueue instructions.

Previously the condition is isCommit, which may be deasserted even
if new instructions are allowed to enqueue.
上级 b56f947e
...@@ -352,7 +352,6 @@ class RobImp(outer: Rob)(implicit p: Parameters) extends LazyModuleImp(outer) ...@@ -352,7 +352,6 @@ class RobImp(outer: Rob)(implicit p: Parameters) extends LazyModuleImp(outer)
val deqPtrVec = Wire(Vec(CommitWidth, new RobPtr)) val deqPtrVec = Wire(Vec(CommitWidth, new RobPtr))
val walkPtrVec = Reg(Vec(CommitWidth, new RobPtr)) val walkPtrVec = Reg(Vec(CommitWidth, new RobPtr))
val validCounter = RegInit(0.U(log2Ceil(RobSize + 1).W))
val allowEnqueue = RegInit(true.B) val allowEnqueue = RegInit(true.B)
val enqPtr = enqPtrVec.head val enqPtr = enqPtrVec.head
...@@ -453,13 +452,8 @@ class RobImp(outer: Rob)(implicit p: Parameters) extends LazyModuleImp(outer) ...@@ -453,13 +452,8 @@ class RobImp(outer: Rob)(implicit p: Parameters) extends LazyModuleImp(outer)
} }
} }
} }
val dispatchNum = Mux(io.enq.canAccept, PopCount(Cat(io.enq.req.map(_.valid))), 0.U) val dispatchNum = Mux(io.enq.canAccept, PopCount(io.enq.req.map(_.valid)), 0.U)
io.enq.isEmpty := RegNext(isEmpty && dispatchNum === 0.U) io.enq.isEmpty := RegNext(isEmpty && !VecInit(io.enq.req.map(_.valid)).asUInt.orR)
// debug info for enqueue (dispatch)
XSDebug(p"(ready, valid): ${io.enq.canAccept}, ${Binary(Cat(io.enq.req.map(_.valid)))}\n")
XSInfo(dispatchNum =/= 0.U, p"dispatched $dispatchNum insts\n")
/** /**
* Writeback (from execution units) * Writeback (from execution units)
...@@ -717,18 +711,10 @@ class RobImp(outer: Rob)(implicit p: Parameters) extends LazyModuleImp(outer) ...@@ -717,18 +711,10 @@ class RobImp(outer: Rob)(implicit p: Parameters) extends LazyModuleImp(outer)
) )
walkPtrVec := walkPtrVec_next walkPtrVec := walkPtrVec_next
val lastCycleRedirect = RegNext(io.redirect.valid) val numValidEntries = distanceBetween(enqPtr, deqPtr)
val trueValidCounter = Mux(lastCycleRedirect, distanceBetween(enqPtr, deqPtr), validCounter)
val commitCnt = PopCount(io.commits.commitValid) val commitCnt = PopCount(io.commits.commitValid)
validCounter := Mux(io.commits.isCommit,
(validCounter - commitCnt) + dispatchNum,
trueValidCounter
)
allowEnqueue := Mux(io.commits.isCommit, allowEnqueue := numValidEntries + dispatchNum <= (RobSize - RenameWidth).U
validCounter + dispatchNum <= (RobSize - RenameWidth).U,
trueValidCounter <= (RobSize - RenameWidth).U
)
val currentWalkPtr = Mux(state === s_walk || state === s_extrawalk, walkPtr, enqPtr - 1.U) val currentWalkPtr = Mux(state === s_walk || state === s_extrawalk, walkPtr, enqPtr - 1.U)
val redirectWalkDistance = distanceBetween(currentWalkPtr, io.redirect.bits.robIdx) val redirectWalkDistance = distanceBetween(currentWalkPtr, io.redirect.bits.robIdx)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册