Skip to content

Commit a94ed9a

Browse files
authored
timing(STU, StoreMisalignBuffer): adjust misalign buffer enq logic (#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`.
1 parent 99ce557 commit a94ed9a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/scala/xiangshan/mem/lsqueue/StoreMisalignBuffer.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ class StoreMisalignBuffer(implicit p: Parameters) extends XSModule
159159
when(canEnq) {
160160
connectSamePort(req, reqSelBits)
161161
req.portIndex := reqSelPort
162-
req_valid := true.B
162+
req_valid := !reqSelBits.hasException
163163
}
164164
val cross4KBPageEnq = WireInit(false.B)
165165
when (cross4KBPageBoundary && !reqRedirect) {
166166
when(
167-
reqSelValid &&
167+
reqSelValid && !reqSelBits.hasException &&
168168
(isAfter(req.uop.robIdx, reqSelBits.uop.robIdx) || (isNotBefore(req.uop.robIdx, reqSelBits.uop.robIdx) && req.uop.uopIdx > reqSelBits.uop.uopIdx)) &&
169169
bufferState === s_idle
170170
) {

src/main/scala/xiangshan/mem/pipeline/StoreUnit.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,10 @@ class StoreUnit(implicit p: Parameters) extends XSModule
472472

473473
val s2_mis_align = s2_valid && RegEnable(s1_mis_align, s1_fire) && !s2_exception
474474
// goto misalignBuffer
475-
val toMisalignBufferValid = s2_mis_align && !s2_frm_mabuf
475+
val toMisalignBufferValid = s2_valid && GatedValidRegNext(s1_mis_align && !s1_frm_mabuf)
476476
io.misalign_buf.valid := toMisalignBufferValid
477477
io.misalign_buf.bits := s2_in
478+
io.misalign_buf.bits.hasException := s2_exception
478479
val misalignBufferNack = toMisalignBufferValid && !io.misalign_buf.ready
479480

480481
// feedback tlb miss to RS in store_s2

0 commit comments

Comments
 (0)