Integrate L1 BusErrorUnit
This commit is contained in:
parent
dbf599f6a1
commit
afad25fceb
@ -84,6 +84,8 @@ trait HasRocketTiles extends HasSystemBus
|
|||||||
lip.foreach { coreIntXbar.intnode := _ } // lip
|
lip.foreach { coreIntXbar.intnode := _ } // lip
|
||||||
wrapper.coreIntNode := coreIntXbar.intnode
|
wrapper.coreIntNode := coreIntXbar.intnode
|
||||||
|
|
||||||
|
wrapper.intOutputNode.foreach { plic.intnode := _ }
|
||||||
|
|
||||||
wrapper
|
wrapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,14 @@ class L1BusErrors(implicit p: Parameters) extends CoreBundle()(p) with BusErrors
|
|||||||
None, None, dcache.correctable, dcache.uncorrectable)
|
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 regWidth = 64
|
||||||
val size = 64
|
|
||||||
val device = new SimpleDevice("bus-error-unit", Seq("sifive,buserror0"))
|
val device = new SimpleDevice("bus-error-unit", Seq("sifive,buserror0"))
|
||||||
val intNode = IntSourceNode(IntSourcePortSimple(resources = device.int))
|
val intNode = IntSourceNode(IntSourcePortSimple(resources = device.int))
|
||||||
val node = TLRegisterNode(
|
val node = TLRegisterNode(
|
||||||
address = Seq(AddressSet(addr, size-1)),
|
address = Seq(AddressSet(params.addr, params.size-1)),
|
||||||
device = device,
|
device = device,
|
||||||
beatBytes = p(XLen)/8)
|
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 sources = io.errors.toErrorList
|
||||||
val mask = sources.map(_.nonEmpty.B).asUInt
|
val mask = sources.map(_.nonEmpty.B).asUInt
|
||||||
val cause = Reg(init = UInt(0, log2Ceil(sources.lastIndexWhere(_.nonEmpty) + 1)))
|
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)
|
require(value.getWidth <= regWidth)
|
||||||
val enable = Reg(init = mask)
|
val enable = Reg(init = mask)
|
||||||
val interrupt = Reg(init = UInt(0, sources.size))
|
val interrupt = Reg(init = UInt(0, sources.size))
|
||||||
|
@ -30,6 +30,7 @@ case class RocketCoreParams(
|
|||||||
fastLoadWord: Boolean = true,
|
fastLoadWord: Boolean = true,
|
||||||
fastLoadByte: Boolean = false,
|
fastLoadByte: Boolean = false,
|
||||||
jumpInFrontend: Boolean = true,
|
jumpInFrontend: Boolean = true,
|
||||||
|
tileControlAddr: Option[BigInt] = None,
|
||||||
mulDiv: Option[MulDivParams] = Some(MulDivParams()),
|
mulDiv: Option[MulDivParams] = Some(MulDivParams()),
|
||||||
fpu: Option[FPUParams] = Some(FPUParams())
|
fpu: Option[FPUParams] = Some(FPUParams())
|
||||||
) extends CoreParams {
|
) extends CoreParams {
|
||||||
|
@ -100,21 +100,29 @@ trait CanHaveScratchpad extends HasHellaCache with HasICacheFrontend {
|
|||||||
val module: CanHaveScratchpadModule
|
val module: CanHaveScratchpadModule
|
||||||
val cacheBlockBytes = p(CacheBlockBytes)
|
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
|
// 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
|
// 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 fg = LazyModule(new TLFragmenter(tileParams.core.fetchBytes, cacheBlockBytes, earlyAck=true))
|
||||||
val ww = LazyModule(new TLWidthWidget(xBytes))
|
val ww = LazyModule(new TLWidthWidget(xBytes))
|
||||||
val scratch = tileParams.dcache.flatMap { d => d.scratch.map(s =>
|
val scratch = tileParams.dcache.flatMap { d => d.scratch.map(s =>
|
||||||
LazyModule(new ScratchpadSlavePort(AddressSet(s, d.dataScratchpadBytes-1), xBytes, tileParams.core.useAtomics)))
|
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 =>
|
DisableMonitors { implicit p =>
|
||||||
frontend.slaveNode :*= fg.node
|
frontend.slaveNode :*= fg.node
|
||||||
fg.node :*= ww.node
|
fg.node :*= ww.node
|
||||||
ww.node :*= slaveNode
|
ww.node :*= slaveNode
|
||||||
scratch foreach { lm => lm.node := TLFragmenter(xBytes, cacheBlockBytes, earlyAck=true)(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 =>
|
def findScratchpadFromICache: Option[AddressSet] = scratch.map { s =>
|
||||||
@ -130,6 +138,7 @@ trait CanHaveScratchpad extends HasHellaCache with HasICacheFrontend {
|
|||||||
trait CanHaveScratchpadBundle extends HasHellaCacheBundle with HasICacheFrontendBundle {
|
trait CanHaveScratchpadBundle extends HasHellaCacheBundle with HasICacheFrontendBundle {
|
||||||
val outer: CanHaveScratchpad
|
val outer: CanHaveScratchpad
|
||||||
val slave = outer.slaveNode.bundleIn
|
val slave = outer.slaveNode.bundleIn
|
||||||
|
val intOutput = outer.intOutputNode.map(_.bundleOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
trait CanHaveScratchpadModule extends HasHellaCacheModule with HasICacheFrontendModule {
|
trait CanHaveScratchpadModule extends HasHellaCacheModule with HasICacheFrontendModule {
|
||||||
@ -137,4 +146,8 @@ trait CanHaveScratchpadModule extends HasHellaCacheModule with HasICacheFrontend
|
|||||||
val io: CanHaveScratchpadBundle
|
val io: CanHaveScratchpadBundle
|
||||||
|
|
||||||
outer.scratch.foreach { lm => dcachePorts += lm.module.io.dmem }
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ trait CoreParams {
|
|||||||
val nLocalInterrupts: Int
|
val nLocalInterrupts: Int
|
||||||
val nL2TLBEntries: Int
|
val nL2TLBEntries: Int
|
||||||
val jumpInFrontend: Boolean
|
val jumpInFrontend: Boolean
|
||||||
|
val tileControlAddr: Option[BigInt]
|
||||||
|
|
||||||
def instBytes: Int = instBits / 8
|
def instBytes: Int = instBits / 8
|
||||||
def fetchBytes: Int = fetchWidth * instBytes
|
def fetchBytes: Int = fetchWidth * instBytes
|
||||||
|
@ -168,6 +168,7 @@ abstract class RocketTileWrapper(rtp: RocketTileParams, hartid: Int)(implicit p:
|
|||||||
val rocket = LazyModule(new RocketTile(rtp, hartid))
|
val rocket = LazyModule(new RocketTile(rtp, hartid))
|
||||||
val masterNode: OutputNode[_,_,_,_,_]
|
val masterNode: OutputNode[_,_,_,_,_]
|
||||||
val slaveNode: InputNode[_,_,_,_,_]
|
val slaveNode: InputNode[_,_,_,_,_]
|
||||||
|
val intOutputNode = rocket.intOutputNode.map(dummy => IntOutputNode())
|
||||||
val asyncIntNode = IntInputNode()
|
val asyncIntNode = IntInputNode()
|
||||||
val periphIntNode = IntInputNode()
|
val periphIntNode = IntInputNode()
|
||||||
val coreIntNode = IntInputNode()
|
val coreIntNode = IntInputNode()
|
||||||
@ -195,10 +196,19 @@ abstract class RocketTileWrapper(rtp: RocketTileParams, hartid: Int)(implicit p:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def outputInterruptXingLatency: Int
|
||||||
|
|
||||||
|
rocket.intOutputNode.foreach { rocketIntOutputNode =>
|
||||||
|
val outXing = LazyModule(new IntXing(outputInterruptXingLatency))
|
||||||
|
intOutputNode.get := outXing.intnode
|
||||||
|
outXing.intnode := rocketIntOutputNode
|
||||||
|
}
|
||||||
|
|
||||||
lazy val module = new LazyModuleImp(this) {
|
lazy val module = new LazyModuleImp(this) {
|
||||||
val io = new CoreBundle with HasExternallyDrivenTileConstants {
|
val io = new CoreBundle with HasExternallyDrivenTileConstants {
|
||||||
val master = masterNode.bundleOut
|
val master = masterNode.bundleOut
|
||||||
val slave = slaveNode.bundleIn
|
val slave = slaveNode.bundleIn
|
||||||
|
val outputInterrupts = intOutputNode.map(_.bundleOut)
|
||||||
val asyncInterrupts = asyncIntNode.bundleIn
|
val asyncInterrupts = asyncIntNode.bundleIn
|
||||||
val periphInterrupts = periphIntNode.bundleIn
|
val periphInterrupts = periphIntNode.bundleIn
|
||||||
val coreInterrupts = coreIntNode.bundleIn
|
val coreInterrupts = coreIntNode.bundleIn
|
||||||
@ -224,6 +234,8 @@ class SyncRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Parameters)
|
|||||||
intXbar.intnode := xing.intnode
|
intXbar.intnode := xing.intnode
|
||||||
intXbar.intnode := periphIntNode
|
intXbar.intnode := periphIntNode
|
||||||
intXbar.intnode := coreIntNode
|
intXbar.intnode := coreIntNode
|
||||||
|
|
||||||
|
def outputInterruptXingLatency = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
class AsyncRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Parameters) extends RocketTileWrapper(rtp, hartid) {
|
class AsyncRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Parameters) extends RocketTileWrapper(rtp, hartid) {
|
||||||
@ -251,6 +263,8 @@ class AsyncRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Parameters
|
|||||||
intXbar.intnode := asyncXing.intnode
|
intXbar.intnode := asyncXing.intnode
|
||||||
intXbar.intnode := periphXing.intnode
|
intXbar.intnode := periphXing.intnode
|
||||||
intXbar.intnode := coreIntNode
|
intXbar.intnode := coreIntNode
|
||||||
|
|
||||||
|
def outputInterruptXingLatency = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
class RationalRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Parameters) extends RocketTileWrapper(rtp, hartid) {
|
class RationalRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Parameters) extends RocketTileWrapper(rtp, hartid) {
|
||||||
@ -279,4 +293,6 @@ class RationalRocketTile(rtp: RocketTileParams, hartid: Int)(implicit p: Paramet
|
|||||||
intXbar.intnode := asyncXing.intnode
|
intXbar.intnode := asyncXing.intnode
|
||||||
intXbar.intnode := periphXing.intnode
|
intXbar.intnode := periphXing.intnode
|
||||||
intXbar.intnode := coreIntNode
|
intXbar.intnode := coreIntNode
|
||||||
|
|
||||||
|
def outputInterruptXingLatency = 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user