diff --git a/src/main/scala/rocket/CSR.scala b/src/main/scala/rocket/CSR.scala index 0bf870df..0578a2fb 100644 --- a/src/main/scala/rocket/CSR.scala +++ b/src/main/scala/rocket/CSR.scala @@ -837,6 +837,6 @@ class CSRFile(perfEventSets: EventSets = new EventSets(Seq()))(implicit p: Param when (decoded_addr(lo)) { ctr := wdata(ctr.getWidth-1, 0) } } } - def formEPC(x: UInt) = ~(~x | Cat(!reg_misa('c'-'a'), UInt(1))) + def formEPC(x: UInt) = ~(~x | (if (usingCompressed) 1.U else 3.U)) def isaStringToMask(s: String) = s.map(x => 1 << (x - 'A')).foldLeft(0)(_|_) } diff --git a/src/main/scala/rocket/RocketCore.scala b/src/main/scala/rocket/RocketCore.scala index d66bade9..681eceec 100644 --- a/src/main/scala/rocket/RocketCore.scala +++ b/src/main/scala/rocket/RocketCore.scala @@ -228,12 +228,14 @@ class Rocket(implicit p: Parameters) extends CoreModule()(p) bpu.io.pc := ibuf.io.pc bpu.io.ea := mem_reg_wdata + val id_pc_misaligned = !csr.io.status.isa('c'-'a') && ibuf.io.pc(1) val id_xcpt0 = ibuf.io.inst(0).bits.xcpt0 val id_xcpt1 = ibuf.io.inst(0).bits.xcpt1 val (id_xcpt, id_cause) = checkExceptions(List( (csr.io.interrupt, csr.io.interrupt_cause), (bpu.io.debug_if, UInt(CSR.debugTriggerCause)), (bpu.io.xcpt_if, UInt(Causes.breakpoint)), + (id_pc_misaligned, UInt(Causes.misaligned_fetch)), (id_xcpt0.pf.inst, UInt(Causes.fetch_page_fault)), (id_xcpt0.ae.inst, UInt(Causes.fetch_access)), (id_xcpt1.pf.inst, UInt(Causes.fetch_page_fault)),