2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
// See LICENSE.Berkeley for license details.
|
2014-09-13 03:06:41 +02:00
|
|
|
|
2012-03-25 00:56:59 +01:00
|
|
|
package rocket
|
|
|
|
|
|
|
|
import Chisel._
|
2017-01-17 03:24:08 +01:00
|
|
|
import config._
|
|
|
|
import coreplex._
|
2016-10-27 04:02:04 +02:00
|
|
|
import diplomacy._
|
2017-02-09 22:59:09 +01:00
|
|
|
import tile._
|
2016-06-28 22:15:39 +02:00
|
|
|
import uncore.devices._
|
2017-01-17 03:24:08 +01:00
|
|
|
import uncore.tilelink2._
|
2016-09-28 06:27:07 +02:00
|
|
|
import util._
|
2012-03-25 00:56:59 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
case class RocketTileParams(
|
|
|
|
core: RocketCoreParams = RocketCoreParams(),
|
|
|
|
icache: Option[ICacheParams] = Some(ICacheParams()),
|
|
|
|
dcache: Option[DCacheParams] = Some(DCacheParams()),
|
|
|
|
rocc: Seq[RoCCParams] = Nil,
|
|
|
|
btb: Option[BTBParams] = Some(BTBParams()),
|
|
|
|
dataScratchpadBytes: Int = 0) extends TileParams {
|
|
|
|
require(icache.isDefined)
|
|
|
|
require(dcache.isDefined)
|
|
|
|
}
|
|
|
|
|
|
|
|
class RocketTile(val rocketParams: RocketTileParams)(implicit p: Parameters) extends BaseTile(rocketParams)(p)
|
2017-01-17 03:24:08 +01:00
|
|
|
with CanHaveLegacyRoccs // implies CanHaveSharedFPU with CanHavePTW with HasHellaCache
|
|
|
|
with CanHaveScratchpad { // implies CanHavePTW with HasHellaCache with HasICacheFrontend
|
2015-12-02 02:54:56 +01:00
|
|
|
|
2017-01-17 03:24:08 +01:00
|
|
|
nDCachePorts += 1 // core TODO dcachePorts += () => module.core.io.dmem ??
|
2014-08-08 21:23:02 +02:00
|
|
|
|
2017-01-17 03:24:08 +01:00
|
|
|
override lazy val module = new RocketTileModule(this)
|
|
|
|
}
|
2016-11-11 22:07:45 +01:00
|
|
|
|
2017-01-17 03:24:08 +01:00
|
|
|
class RocketTileBundle(outer: RocketTile) extends BaseTileBundle(outer)
|
|
|
|
with CanHaveScratchpadBundle
|
|
|
|
|
|
|
|
class RocketTileModule(outer: RocketTile) extends BaseTileModule(outer, () => new RocketTileBundle(outer))
|
|
|
|
with CanHaveLegacyRoccsModule
|
|
|
|
with CanHaveScratchpadModule {
|
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
val core = Module(p(BuildCore)(outer.p))
|
2017-01-17 03:24:08 +01:00
|
|
|
core.io.interrupts := io.interrupts
|
|
|
|
core.io.hartid := io.hartid
|
|
|
|
outer.frontend.module.io.cpu <> core.io.imem
|
|
|
|
outer.frontend.module.io.resetVector := io.resetVector
|
|
|
|
dcachePorts += core.io.dmem // TODO outer.dcachePorts += () => module.core.io.dmem ??
|
|
|
|
fpuOpt foreach { fpu => core.io.fpu <> fpu.io }
|
|
|
|
ptwOpt foreach { ptw => core.io.ptw <> ptw.io.dpath }
|
|
|
|
outer.legacyRocc foreach { lr =>
|
|
|
|
lr.module.io.core.cmd <> core.io.rocc.cmd
|
|
|
|
lr.module.io.core.exception := core.io.rocc.exception
|
|
|
|
core.io.rocc.resp <> lr.module.io.core.resp
|
|
|
|
core.io.rocc.busy := lr.module.io.core.busy
|
|
|
|
core.io.rocc.interrupt := lr.module.io.core.interrupt
|
2016-11-21 21:19:33 +01:00
|
|
|
}
|
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
// TODO eliminate this redundancy
|
|
|
|
val h = dcachePorts.size
|
|
|
|
val c = core.dcacheArbPorts
|
|
|
|
val o = outer.nDCachePorts
|
|
|
|
require(h == c, s"port list size was $h, core expected $c")
|
|
|
|
require(h == o, s"port list size was $h, outer counted $o")
|
2017-01-17 03:24:08 +01:00
|
|
|
// TODO figure out how to move the below into their respective mix-ins
|
|
|
|
dcacheArb.io.requestor <> dcachePorts
|
|
|
|
ptwOpt foreach { ptw => ptw.io.requestor <> ptwPorts }
|
|
|
|
}
|
2016-11-11 00:56:42 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
class AsyncRocketTile(rtp: RocketTileParams)(implicit p: Parameters) extends LazyModule {
|
|
|
|
val rocket = LazyModule(new RocketTile(rtp))
|
2016-11-30 01:34:26 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
val masterNode = TLAsyncOutputNode()
|
|
|
|
val source = LazyModule(new TLAsyncCrossingSource)
|
|
|
|
source.node :=* rocket.masterNode
|
|
|
|
masterNode :=* source.node
|
2017-01-17 03:24:08 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
val slaveNode = TLAsyncInputNode()
|
|
|
|
val sink = LazyModule(new TLAsyncCrossingSink)
|
|
|
|
rocket.slaveNode :*= sink.node
|
|
|
|
sink.node :*= slaveNode
|
2016-11-30 01:34:26 +01:00
|
|
|
|
2016-11-11 00:56:42 +01:00
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
val io = new Bundle {
|
2017-02-09 22:59:09 +01:00
|
|
|
val master = masterNode.bundleOut
|
|
|
|
val slave = slaveNode.bundleIn
|
2016-11-11 00:56:42 +01:00
|
|
|
val hartid = UInt(INPUT, p(XLen))
|
2017-01-17 03:24:08 +01:00
|
|
|
val interrupts = new TileInterrupts()(p).asInput
|
2016-11-11 00:56:42 +01:00
|
|
|
val resetVector = UInt(INPUT, p(XLen))
|
|
|
|
}
|
2017-01-17 03:24:08 +01:00
|
|
|
rocket.module.io.interrupts := ShiftRegister(io.interrupts, 3)
|
|
|
|
// signals that do not change:
|
|
|
|
rocket.module.io.hartid := io.hartid
|
|
|
|
rocket.module.io.resetVector := io.resetVector
|
2015-12-02 05:41:58 +01:00
|
|
|
}
|
2012-03-25 00:56:59 +01:00
|
|
|
}
|
2017-01-28 02:09:43 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
class RationalRocketTile(rtp: RocketTileParams)(implicit p: Parameters) extends LazyModule {
|
|
|
|
val rocket = LazyModule(new RocketTile(rtp))
|
2017-01-28 02:09:43 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
val masterNode = TLRationalOutputNode()
|
|
|
|
val source = LazyModule(new TLRationalCrossingSource)
|
|
|
|
source.node :=* rocket.masterNode
|
|
|
|
masterNode :=* source.node
|
2017-01-28 02:09:43 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
val slaveNode = TLRationalInputNode()
|
2017-02-17 15:15:41 +01:00
|
|
|
val sink = LazyModule(new TLRationalCrossingSink(util.SlowToFast))
|
2017-02-09 22:59:09 +01:00
|
|
|
rocket.slaveNode :*= sink.node
|
|
|
|
sink.node :*= slaveNode
|
2017-01-28 02:09:43 +01:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
val io = new Bundle {
|
2017-02-09 22:59:09 +01:00
|
|
|
val master = masterNode.bundleOut
|
|
|
|
val slave = slaveNode.bundleIn
|
2017-01-28 02:09:43 +01:00
|
|
|
val hartid = UInt(INPUT, p(XLen))
|
|
|
|
val interrupts = new TileInterrupts()(p).asInput
|
|
|
|
val resetVector = UInt(INPUT, p(XLen))
|
|
|
|
}
|
|
|
|
rocket.module.io.interrupts := ShiftRegister(io.interrupts, 1)
|
|
|
|
// signals that do not change:
|
|
|
|
rocket.module.io.hartid := io.hartid
|
|
|
|
rocket.module.io.resetVector := io.resetVector
|
|
|
|
}
|
|
|
|
}
|