1
0

rocket: link itim to its cpu

This commit is contained in:
Wesley W. Terpstra 2017-06-28 14:53:09 -07:00
parent e6c2d446cc
commit 48390ed604
3 changed files with 14 additions and 5 deletions

View File

@ -53,9 +53,9 @@ class FrontendIO(implicit p: Parameters) extends CoreBundle()(p) {
val perf = new FrontendPerfEvents().asInput
}
class Frontend(val icacheParams: ICacheParams, hartid: Int)(implicit p: Parameters) extends LazyModule {
class Frontend(val icacheParams: ICacheParams, hartid: Int, owner: => Option[Device] = None)(implicit p: Parameters) extends LazyModule {
lazy val module = new FrontendModule(this)
val icache = LazyModule(new ICache(icacheParams, hartid))
val icache = LazyModule(new ICache(icacheParams, hartid, owner))
val masterNode = TLOutputNode()
val slaveNode = TLInputNode()
@ -184,7 +184,8 @@ class FrontendModule(outer: Frontend) extends LazyModuleImp(outer)
/** Mix-ins for constructing tiles that have an ICache-based pipeline frontend */
trait HasICacheFrontend extends CanHavePTW with HasTileLinkMasterPort {
val module: HasICacheFrontendModule
val frontend = LazyModule(new Frontend(tileParams.icache.get, hartid: Int))
def itimOwner : Option[Device] = None
val frontend = LazyModule(new Frontend(tileParams.icache.get, hartid: Int, itimOwner))
val hartid: Int
tileBus.node := frontend.masterNode
nPTWPorts += 1

View File

@ -35,12 +35,19 @@ class ICacheReq(implicit p: Parameters) extends CoreBundle()(p) with HasL1ICache
val addr = UInt(width = vaddrBits)
}
class ICache(val icacheParams: ICacheParams, val hartid: Int)(implicit p: Parameters) extends LazyModule {
class ICache(val icacheParams: ICacheParams, val hartid: Int, owner: => Option[Device] = None)(implicit p: Parameters) extends LazyModule {
lazy val module = new ICacheModule(this)
val masterNode = TLClientNode(TLClientParameters(name = s"Core ${hartid} ICache"))
val device = new SimpleDevice("itim", Seq("sifive,itim0")) {
override def describe(resources: ResourceBindings): Description = {
val extra = owner.map(x => ("sifive,cpu" -> Seq(ResourceReference(x.label))))
val Description(name, mapping) = super.describe(resources)
Description(name, mapping ++ extra)
}
}
val size = icacheParams.nSets * icacheParams.nWays * icacheParams.blockBytes
val device = new SimpleDevice("itim", Seq("sifive,itim0"))
val slaveNode = icacheParams.itimAddr.map { itimAddr =>
val wordBytes = icacheParams.fetchBytes
TLManagerNode(Seq(TLManagerPortParameters(

View File

@ -91,6 +91,7 @@ class RocketTile(val rocketParams: RocketTileParams, val hartid: Int)(implicit p
}
override def dtimOwner = Some(cpuDevice)
override def itimOwner = Some(cpuDevice)
val intcDevice = new Device {
def describe(resources: ResourceBindings): Description = {