Skip to content

Commit

Permalink
fix(VecExcp): commit vls exception after Rab commiting all reg pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
huxuan0307 authored and Tang-Haojin committed Oct 19, 2024
1 parent b998549 commit ddb4906
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/scala/xiangshan/backend/rob/Rab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class RenameBuffer(size: Int)(implicit p: Parameters) extends XSModule with HasC

val status = Output(new Bundle {
val walkEnd = Bool()
val commitEnd = Bool()
})
val toVecExcpMod = Output(new RabToVecExcpMod)
})
Expand Down Expand Up @@ -219,6 +220,7 @@ class RenameBuffer(size: Int)(implicit p: Parameters) extends XSModule with HasC
}

private val walkEndNext = walkSizeNxt === 0.U
private val commitEndNext = commitSizeNxt === 0.U
private val specialWalkEndNext = specialWalkSize <= RabCommitWidth.U
// when robWalkEndReg is 1, walkSize donot increase and decrease RabCommitWidth per Cycle
private val walkEndNextCycle = (robWalkEndReg || io.fromRob.walkEnd && io.fromRob.walkSize === 0.U) && (walkSize <= RabCommitWidth.U)
Expand Down Expand Up @@ -263,6 +265,7 @@ class RenameBuffer(size: Int)(implicit p: Parameters) extends XSModule with HasC
io.enqPtrVec := enqPtrVec

io.status.walkEnd := walkEndNext
io.status.commitEnd := commitEndNext

for (i <- 0 until RabCommitWidth) {
io.toVecExcpMod.logicPhyRegMap(i).valid := (state === s_special_walk) && vecLoadExcp.valid &&
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/xiangshan/backend/rob/Rob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ class RobImp(override val wrapper: Rob)(implicit p: Parameters, params: BackendP
val deqHasReplayInst = deqNeedFlushAndHitExceptionGenState && exceptionDataRead.bits.replayInst
val deqIsVlsException = deqHasException && deqPtrEntry.isVls && !exceptionDataRead.bits.isEnqExcp
// delay 2 cycle wait exceptionGen out
deqVlsCanCommit := RegNext(RegNext(deqIsVlsException && deqPtrEntry.commit_w))
// vls exception can be committed only when RAB commit all its reg pairs
deqVlsCanCommit := RegNext(RegNext(deqIsVlsException && deqPtrEntry.commit_w)) && rab.io.status.commitEnd

// lock at assertion of deqVlsExceptionNeedCommit until condition not assert
val deqVlsExcpLock = RegInit(false.B)
Expand Down

0 comments on commit ddb4906

Please sign in to comment.