Skip to content

Commit

Permalink
Expose WFI signal from Rocket tile (#2315)
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman authored Mar 6, 2020
1 parent 875dcd3 commit 0c50092
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/resources/vsrc/RoccBlackBox.v
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/rocket/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/rocket/RocketCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/tile/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion src/main/scala/tile/RocketTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0c50092

Please sign in to comment.