Skip to content

Commit

Permalink
Revise trace.valid gating method to relieve timing on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
ernie-sifive committed Aug 20, 2020
1 parent 9ceab5f commit ede4d59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/rocket/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ class CSRFile(

for (((t, insn), i) <- (io.trace zip io.inst).zipWithIndex) {
t.exception := io.retire >= i && exception
t.valid := (io.retire > i || t.exception) && !reset
t.valid := io.retire > i || t.exception
t.insn := insn
t.iaddr := io.pc
t.priv := Cat(reg_debug, reg_mstatus.prv)
Expand Down
6 changes: 6 additions & 0 deletions src/main/scala/tile/RocketTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)

val core = Module(new Rocket(outer)(outer.p))

val traceValidEnable = Wire(Bool())
withReset(outer.rawReset) { // use unmodified reset for notification ports
// Report unrecoverable error conditions; for now the only cause is cache ECC errors
outer.reportHalt(List(outer.dcache.module.io.errors))
Expand All @@ -149,6 +150,10 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)
core.io.cease))

outer.reportWFI(Some(core.io.wfi))

val outOfReset = RegInit(0.U(2.W))
when (!traceValidEnable) { outOfReset := outOfReset + 1.U }
traceValidEnable := outOfReset.andR // force trace.valid to 0 during and just after async reset without adding any loads to core.reset
}

outer.decodeCoreInterrupts(core.io.interrupts) // Decode the interrupt vector
Expand All @@ -161,6 +166,7 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)

// Pass through various external constants and reports that were bundle-bridged into the tile
outer.traceSourceNode.bundle <> core.io.trace
outer.traceSourceNode.bundle.zip(core.io.trace).foreach { case(tb, t) => tb.valid := t.valid && traceValidEnable }
core.io.traceStall := outer.traceAuxSinkNode.bundle.stall
outer.bpwatchSourceNode.bundle <> core.io.bpwatch
core.io.hartid := outer.hartIdSinkNode.bundle
Expand Down

0 comments on commit ede4d59

Please sign in to comment.