Integrate L1 BusErrorUnit
This commit is contained in:
@ -25,13 +25,14 @@ class L1BusErrors(implicit p: Parameters) extends CoreBundle()(p) with BusErrors
|
||||
None, None, dcache.correctable, dcache.uncorrectable)
|
||||
}
|
||||
|
||||
class BusErrorUnit[T <: BusErrors](t: => T, addr: BigInt)(implicit p: Parameters) extends LazyModule {
|
||||
case class BusErrorUnitParams(addr: BigInt, size: Int = 4096)
|
||||
|
||||
class BusErrorUnit[T <: BusErrors](t: => T, params: BusErrorUnitParams)(implicit p: Parameters) extends LazyModule {
|
||||
val regWidth = 64
|
||||
val size = 64
|
||||
val device = new SimpleDevice("bus-error-unit", Seq("sifive,buserror0"))
|
||||
val intNode = IntSourceNode(IntSourcePortSimple(resources = device.int))
|
||||
val node = TLRegisterNode(
|
||||
address = Seq(AddressSet(addr, size-1)),
|
||||
address = Seq(AddressSet(params.addr, params.size-1)),
|
||||
device = device,
|
||||
beatBytes = p(XLen)/8)
|
||||
|
||||
@ -45,7 +46,7 @@ class BusErrorUnit[T <: BusErrors](t: => T, addr: BigInt)(implicit p: Parameters
|
||||
val sources = io.errors.toErrorList
|
||||
val mask = sources.map(_.nonEmpty.B).asUInt
|
||||
val cause = Reg(init = UInt(0, log2Ceil(sources.lastIndexWhere(_.nonEmpty) + 1)))
|
||||
val value = Reg(UInt(width = sources.flatten.map(_.getWidth).max))
|
||||
val value = Reg(UInt(width = sources.flatten.map(_.bits.getWidth).max))
|
||||
require(value.getWidth <= regWidth)
|
||||
val enable = Reg(init = mask)
|
||||
val interrupt = Reg(init = UInt(0, sources.size))
|
||||
|
@ -30,6 +30,7 @@ case class RocketCoreParams(
|
||||
fastLoadWord: Boolean = true,
|
||||
fastLoadByte: Boolean = false,
|
||||
jumpInFrontend: Boolean = true,
|
||||
tileControlAddr: Option[BigInt] = None,
|
||||
mulDiv: Option[MulDivParams] = Some(MulDivParams()),
|
||||
fpu: Option[FPUParams] = Some(FPUParams())
|
||||
) extends CoreParams {
|
||||
|
@ -100,21 +100,29 @@ trait CanHaveScratchpad extends HasHellaCache with HasICacheFrontend {
|
||||
val module: CanHaveScratchpadModule
|
||||
val cacheBlockBytes = p(CacheBlockBytes)
|
||||
|
||||
val slaveNode = TLInputNode() // Up to two uses for this input node:
|
||||
val intOutputNode = tileParams.core.tileControlAddr.map(dummy => IntOutputNode())
|
||||
val slaveNode = TLInputNode() // Up to three uses for this input node:
|
||||
|
||||
// 1) Frontend always exists, but may or may not have a scratchpad node
|
||||
// 2) ScratchpadSlavePort always has a node, but only exists when the HellaCache has a scratchpad
|
||||
// 3) BusErrorUnit sometimes has a node
|
||||
val fg = LazyModule(new TLFragmenter(tileParams.core.fetchBytes, cacheBlockBytes, earlyAck=true))
|
||||
val ww = LazyModule(new TLWidthWidget(xBytes))
|
||||
val scratch = tileParams.dcache.flatMap { d => d.scratch.map(s =>
|
||||
LazyModule(new ScratchpadSlavePort(AddressSet(s, d.dataScratchpadBytes-1), xBytes, tileParams.core.useAtomics)))
|
||||
}
|
||||
val busErrorUnit = tileParams.core.tileControlAddr map { a =>
|
||||
val beu = LazyModule(new BusErrorUnit(new L1BusErrors, BusErrorUnitParams(a)))
|
||||
intOutputNode.get := beu.intNode
|
||||
beu
|
||||
}
|
||||
|
||||
DisableMonitors { implicit p =>
|
||||
frontend.slaveNode :*= fg.node
|
||||
fg.node :*= ww.node
|
||||
ww.node :*= slaveNode
|
||||
scratch foreach { lm => lm.node := TLFragmenter(xBytes, cacheBlockBytes, earlyAck=true)(slaveNode) }
|
||||
busErrorUnit foreach { lm => lm.node := TLFragmenter(xBytes, cacheBlockBytes, earlyAck=true)(slaveNode) }
|
||||
}
|
||||
|
||||
def findScratchpadFromICache: Option[AddressSet] = scratch.map { s =>
|
||||
@ -130,6 +138,7 @@ trait CanHaveScratchpad extends HasHellaCache with HasICacheFrontend {
|
||||
trait CanHaveScratchpadBundle extends HasHellaCacheBundle with HasICacheFrontendBundle {
|
||||
val outer: CanHaveScratchpad
|
||||
val slave = outer.slaveNode.bundleIn
|
||||
val intOutput = outer.intOutputNode.map(_.bundleOut)
|
||||
}
|
||||
|
||||
trait CanHaveScratchpadModule extends HasHellaCacheModule with HasICacheFrontendModule {
|
||||
@ -137,4 +146,8 @@ trait CanHaveScratchpadModule extends HasHellaCacheModule with HasICacheFrontend
|
||||
val io: CanHaveScratchpadBundle
|
||||
|
||||
outer.scratch.foreach { lm => dcachePorts += lm.module.io.dmem }
|
||||
outer.busErrorUnit.foreach { lm =>
|
||||
lm.module.io.errors.dcache := outer.dcache.module.io.errors
|
||||
lm.module.io.errors.icache := outer.frontend.module.io.errors
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user