Respect breakpoint privilege settings
This commit is contained in:
		| @@ -19,6 +19,7 @@ class BPControl extends Bundle { | ||||
|  | ||||
| class BreakpointUnit(implicit p: Parameters) extends CoreModule()(p) { | ||||
|   val io = new Bundle { | ||||
|     val status = new MStatus().asInput | ||||
|     val bpcontrol = Vec(p(NBreakpoints), new BPControl).asInput | ||||
|     val bpaddress = Vec(p(NBreakpoints), UInt(width = vaddrBits)).asInput | ||||
|     val pc = UInt(INPUT, vaddrBits) | ||||
| @@ -38,8 +39,10 @@ class BreakpointUnit(implicit p: Parameters) extends CoreModule()(p) { | ||||
|       mask = Cat(mask(i-1) && bpa(i-1), mask) | ||||
|  | ||||
|     def matches(x: UInt) = (~x | mask) === (~bpa | mask) | ||||
|     when (matches(io.pc) && bpc.x) { io.xcpt_if := true } | ||||
|     when (matches(io.ea) && bpc.r) { io.xcpt_ld := true } | ||||
|     when (matches(io.ea) && bpc.w) { io.xcpt_st := true } | ||||
|     when (Cat(bpc.m, bpc.h, bpc.s, bpc.u)(io.status.prv)) { | ||||
|       when (matches(io.pc) && bpc.x) { io.xcpt_if := true } | ||||
|       when (matches(io.ea) && bpc.r) { io.xcpt_ld := true } | ||||
|       when (matches(io.ea) && bpc.w) { io.xcpt_st := true } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -227,6 +227,7 @@ class Rocket(implicit p: Parameters) extends CoreModule()(p) { | ||||
|     id_mem_busy && (id_ctrl.amo && id_amo_aq || id_ctrl.fence_i || id_reg_fence && (id_ctrl.mem || id_ctrl.rocc) || id_csr_en) | ||||
|  | ||||
|   val bpu = Module(new BreakpointUnit) | ||||
|   bpu.io.status := csr.io.status | ||||
|   bpu.io.bpcontrol := csr.io.bpcontrol | ||||
|   bpu.io.bpaddress := csr.io.bpaddress | ||||
|   bpu.io.pc := id_pc | ||||
|   | ||||
		Reference in New Issue
	
	Block a user