diff --git a/src/main/scala/xiangshan/backend/fu/PMP.scala b/src/main/scala/xiangshan/backend/fu/PMP.scala index 9bbf70595344258f7916872484453c088f6384c7..c4128e65fc78fa16aed81d8f18ab8a86af77de38 100644 --- a/src/main/scala/xiangshan/backend/fu/PMP.scala +++ b/src/main/scala/xiangshan/backend/fu/PMP.scala @@ -379,8 +379,8 @@ class PMPRespBundle(implicit p: Parameters) extends PMPBundle { trait PMPCheckMethod extends PMPConst { def pmp_check(cmd: UInt, cfg: PMPConfig) = { val resp = Wire(new PMPRespBundle) - resp.ld := TlbCmd.isRead(cmd) && !TlbCmd.isAtom(cmd) && !cfg.r - resp.st := (TlbCmd.isWrite(cmd) || TlbCmd.isAtom(cmd)) && !cfg.w + resp.ld := TlbCmd.isRead(cmd) && !TlbCmd.isAmo(cmd) && !cfg.r + resp.st := (TlbCmd.isWrite(cmd) || TlbCmd.isAmo(cmd)) && !cfg.w resp.instr := TlbCmd.isExec(cmd) && !cfg.x resp.mmio := false.B resp diff --git a/src/main/scala/xiangshan/mem/pipeline/AtomicsUnit.scala b/src/main/scala/xiangshan/mem/pipeline/AtomicsUnit.scala index b2232cbae99cfe6902d8a288454a741ab1a5ca40..dd57fa7c8f7634681388f8349447ca1d4682cae0 100644 --- a/src/main/scala/xiangshan/mem/pipeline/AtomicsUnit.scala +++ b/src/main/scala/xiangshan/mem/pipeline/AtomicsUnit.scala @@ -127,9 +127,8 @@ class AtomicsUnit(implicit p: Parameters) extends XSModule with MemoryOpConstant // keep firing until tlb hit io.dtlb.req.valid := true.B io.dtlb.req.bits.vaddr := in.src(0) - val is_lr = in.uop.ctrl.fuOpType === LSUOpType.lr_w || in.uop.ctrl.fuOpType === LSUOpType.lr_d - io.dtlb.req.bits.cmd := Mux(is_lr, TlbCmd.atom_read, TlbCmd.atom_write) - io.dtlb.req.bits.debug.robIdx := in.uop.robIdx + io.dtlb.resp.ready := true.B + io.dtlb.req.bits.cmd := Mux(isLr, TlbCmd.atom_read, TlbCmd.atom_write) io.dtlb.req.bits.debug.pc := in.uop.cf.pc io.dtlb.req.bits.debug.isFirstIssue := false.B @@ -179,7 +178,7 @@ class AtomicsUnit(implicit p: Parameters) extends XSModule with MemoryOpConstant // NOTE: only handle load/store exception here, if other exception happens, don't send here val exception_va = exceptionVec(storePageFault) || exceptionVec(loadPageFault) || exceptionVec(storeAccessFault) || exceptionVec(loadAccessFault) - val exception_pa = pmp.st + val exception_pa = pmp.st || pmp.ld when (exception_va || exception_pa) { state := s_finish out_valid := true.B @@ -188,6 +187,9 @@ class AtomicsUnit(implicit p: Parameters) extends XSModule with MemoryOpConstant // if sbuffer has been flushed, go to query dcache, otherwise wait for sbuffer. state := Mux(sbuffer_empty, s_cache_req, s_wait_flush_sbuffer_resp); } + // update storeAccessFault bit + exceptionVec(loadAccessFault) := exceptionVec(loadAccessFault) || pmp.ld && isLr + exceptionVec(storeAccessFault) := exceptionVec(storeAccessFault) || pmp.st || pmp.ld && !isLr } when (state === s_wait_flush_sbuffer_resp) {