Skip to content

Commit 48f7f55

Browse files
authored
fix(LDU): only tlb hit can use tlb resp (#4293)
1 parent 7edcfc9 commit 48f7f55

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,8 @@ class LoadUnit(implicit p: Parameters) extends XSModule
918918
val s1_exception = ExceptionNO.selectByFu(s1_out.uop.exceptionVec, LduCfg).asUInt.orR // af & pf exception were modified below.
919919
val s1_tlb_miss = io.tlb.resp.bits.miss && io.tlb.resp.valid && s1_valid
920920
val s1_tlb_fast_miss = io.tlb.resp.bits.fastMiss && io.tlb.resp.valid && s1_valid
921-
val s1_pbmt = Mux(!s1_tlb_miss, io.tlb.resp.bits.pbmt.head, 0.U(Pbmt.width.W))
921+
val s1_tlb_hit = !io.tlb.resp.bits.miss && io.tlb.resp.valid && s1_valid
922+
val s1_pbmt = Mux(s1_tlb_hit, io.tlb.resp.bits.pbmt.head, 0.U(Pbmt.width.W))
922923
val s1_nc = s1_in.nc
923924
val s1_prf = s1_in.isPrefetch
924925
val s1_hw_prf = s1_in.isHWPrefetch
@@ -1205,7 +1206,7 @@ class LoadUnit(implicit p: Parameters) extends XSModule
12051206
// * ecc data error is slow to generate, so we will not use it until load stage 3
12061207
// * in load stage 3, an extra signal io.load_error will be used to
12071208
// * if pbmt =/= 0, mmio is up to pbmt; otherwise, it's up to pmp
1208-
val s2_tlb_hit = RegNext(!io.tlb.resp.bits.miss && io.tlb.resp.valid && s1_valid)
1209+
val s2_tlb_hit = RegNext(s1_tlb_hit)
12091210
val s2_mmio = !s2_prf &&
12101211
!s2_exception && !s2_in.tlbMiss &&
12111212
Mux(Pbmt.isUncache(s2_pbmt), s2_in.mmio, s2_tlb_hit && s2_pmp.mmio)

0 commit comments

Comments
 (0)