diff --git a/src/main/resources/vsrc/RoccBlackBox.v b/src/main/resources/vsrc/RoccBlackBox.v index 4e2d4422a30..fa6e210af11 100644 --- a/src/main/resources/vsrc/RoccBlackBox.v +++ b/src/main/resources/vsrc/RoccBlackBox.v @@ -29,6 +29,7 @@ module RoccBlackBox input [xLen-1:0] rocc_cmd_bits_rs2, input rocc_cmd_bits_status_debug, input rocc_cmd_bits_status_cease, + input rocc_cmd_bits_status_wfi, input [31:0] rocc_cmd_bits_status_isa, input [PRV_SZ-1:0] rocc_cmd_bits_status_dprv, input [PRV_SZ-1:0] rocc_cmd_bits_status_prv, diff --git a/src/main/scala/rocket/CSR.scala b/src/main/scala/rocket/CSR.scala index 538f06fa780..0cf3d0d2b40 100644 --- a/src/main/scala/rocket/CSR.scala +++ b/src/main/scala/rocket/CSR.scala @@ -17,6 +17,7 @@ class MStatus extends Bundle { // not truly part of mstatus, but convenient val debug = Bool() val cease = Bool() + val wfi = Bool() val isa = UInt(width = 32) val dprv = UInt(width = PRV.SZ) // effective privilege for data accesses @@ -741,6 +742,7 @@ class CSRFile( io.time := reg_cycle io.csr_stall := reg_wfi || io.status.cease io.status.cease := RegEnable(true.B, false.B, insn_cease) + io.status.wfi := reg_wfi for ((io, reg) <- io.customCSRs zip reg_custom) { io.wen := false diff --git a/src/main/scala/rocket/RocketCore.scala b/src/main/scala/rocket/RocketCore.scala index abdbdf93e29..43b93313d78 100644 --- a/src/main/scala/rocket/RocketCore.scala +++ b/src/main/scala/rocket/RocketCore.scala @@ -846,6 +846,7 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p) val unpause = csr.io.time(rocketParams.lgPauseCycles-1, 0) === 0 || io.dmem.perf.release || take_pc when (unpause) { id_reg_pause := false } io.cease := csr.io.status.cease && !clock_en_reg + io.wfi := csr.io.status.wfi if (rocketParams.clockGate) { long_latency_stall := csr.io.csr_stall || io.dmem.perf.blocked || id_reg_pause && !unpause clock_en := clock_en_reg || ex_pc_valid || (!long_latency_stall && io.imem.resp.valid) diff --git a/src/main/scala/tile/Core.scala b/src/main/scala/tile/Core.scala index 0e82e7dd885..63314dd4ea4 100644 --- a/src/main/scala/tile/Core.scala +++ b/src/main/scala/tile/Core.scala @@ -127,6 +127,7 @@ trait HasCoreIO extends HasTileParameters { val trace = Vec(coreParams.retireWidth, new TracedInstruction).asOutput val bpwatch = Vec(coreParams.nBreakpoints, new BPWatch(coreParams.retireWidth)).asOutput val cease = Bool().asOutput + val wfi = Bool().asOutput val traceStall = Bool().asInput } } diff --git a/src/main/scala/tile/RocketTile.scala b/src/main/scala/tile/RocketTile.scala index 6c1d0bdb356..911d6adf297 100644 --- a/src/main/scala/tile/RocketTile.scala +++ b/src/main/scala/tile/RocketTile.scala @@ -135,7 +135,7 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer) !ptw.io.dpath.clock_enabled && core.io.cease)) - outer.reportWFI(None) // TODO: actually report this? + outer.reportWFI(Some(core.io.wfi)) outer.decodeCoreInterrupts(core.io.interrupts) // Decode the interrupt vector