Skip to content

Commit

Permalink
timing(STU, StoreMisalignBuffer): adjust misalign buffer enq logic (O…
Browse files Browse the repository at this point in the history
…penXiangShan#4254)

There is no exception misaligned store instruction enters the
misalignbuffer. Due to the exception timing difference generated by the
`PMA`, the timing of the misalignbuffer rejection condition is bad
timing, which in turn leads to the bad timing of `feedback_slow.hit`.
  • Loading branch information
cz4e authored Feb 20, 2025
1 parent 99ce557 commit a94ed9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ class StoreMisalignBuffer(implicit p: Parameters) extends XSModule
when(canEnq) {
connectSamePort(req, reqSelBits)
req.portIndex := reqSelPort
req_valid := true.B
req_valid := !reqSelBits.hasException
}
val cross4KBPageEnq = WireInit(false.B)
when (cross4KBPageBoundary && !reqRedirect) {
when(
reqSelValid &&
reqSelValid && !reqSelBits.hasException &&
(isAfter(req.uop.robIdx, reqSelBits.uop.robIdx) || (isNotBefore(req.uop.robIdx, reqSelBits.uop.robIdx) && req.uop.uopIdx > reqSelBits.uop.uopIdx)) &&
bufferState === s_idle
) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/xiangshan/mem/pipeline/StoreUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,10 @@ class StoreUnit(implicit p: Parameters) extends XSModule

val s2_mis_align = s2_valid && RegEnable(s1_mis_align, s1_fire) && !s2_exception
// goto misalignBuffer
val toMisalignBufferValid = s2_mis_align && !s2_frm_mabuf
val toMisalignBufferValid = s2_valid && GatedValidRegNext(s1_mis_align && !s1_frm_mabuf)
io.misalign_buf.valid := toMisalignBufferValid
io.misalign_buf.bits := s2_in
io.misalign_buf.bits.hasException := s2_exception
val misalignBufferNack = toMisalignBufferValid && !io.misalign_buf.ready

// feedback tlb miss to RS in store_s2
Expand Down

0 comments on commit a94ed9a

Please sign in to comment.