2014-09-13 03:06:41 +02:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
2012-03-25 00:56:59 +01:00
|
|
|
package rocket
|
|
|
|
|
|
|
|
import Chisel._
|
2012-10-02 01:08:41 +02:00
|
|
|
import uncore._
|
2012-11-18 02:24:08 +01:00
|
|
|
import Util._
|
2015-10-22 03:18:32 +02:00
|
|
|
import cde.{Parameters, Field}
|
2012-03-25 00:56:59 +01:00
|
|
|
|
2014-09-08 02:54:41 +02:00
|
|
|
case object CoreName extends Field[String]
|
2015-11-26 01:02:27 +01:00
|
|
|
case object BuildRoCC extends Field[Seq[Parameters => RoCC]]
|
|
|
|
case object RoccOpcodes extends Field[Seq[OpcodeSet]]
|
|
|
|
case object RoccAcceleratorMemChannels extends Field[Seq[Int]]
|
2014-08-08 21:23:02 +02:00
|
|
|
|
2015-10-06 06:48:05 +02:00
|
|
|
abstract class Tile(resetSignal: Bool = null)
|
|
|
|
(implicit p: Parameters) extends Module(_reset = resetSignal) {
|
2015-11-26 01:02:27 +01:00
|
|
|
val buildRocc = p(BuildRoCC)
|
|
|
|
val roccOpcodes = p(RoccOpcodes)
|
|
|
|
val roccMemChannels = p(RoccAcceleratorMemChannels)
|
|
|
|
val usingRocc = !buildRocc.isEmpty
|
|
|
|
val nRocc = buildRocc.size
|
|
|
|
val nDCachePorts = 2 + nRocc
|
|
|
|
val nPTWPorts = 2 + 3 * nRocc
|
2015-10-21 00:02:24 +02:00
|
|
|
val nCachedTileLinkPorts = 1
|
2015-11-26 01:02:27 +01:00
|
|
|
val nUncachedTileLinkPorts = 1 + p(RoccNMemChannels)
|
2015-10-21 00:02:24 +02:00
|
|
|
val dcacheParams = p.alterPartial({ case CacheName => "L1D" })
|
2012-03-25 00:56:59 +01:00
|
|
|
val io = new Bundle {
|
2015-10-21 00:02:24 +02:00
|
|
|
val cached = Vec(nCachedTileLinkPorts, new ClientTileLinkIO)
|
|
|
|
val uncached = Vec(nUncachedTileLinkPorts, new ClientUncachedTileLinkIO)
|
2015-10-06 06:48:05 +02:00
|
|
|
val host = new HtifIO
|
2012-03-25 00:56:59 +01:00
|
|
|
}
|
2014-09-24 22:04:20 +02:00
|
|
|
}
|
|
|
|
|
2015-10-06 06:48:05 +02:00
|
|
|
class RocketTile(resetSignal: Bool = null)(implicit p: Parameters) extends Tile(resetSignal)(p) {
|
2015-10-21 00:02:24 +02:00
|
|
|
val core = Module(new Rocket()(p.alterPartial({ case CoreName => "Rocket" })))
|
2015-10-06 06:48:05 +02:00
|
|
|
val icache = Module(new Frontend()(p.alterPartial({
|
2015-10-21 00:02:24 +02:00
|
|
|
case CacheName => "L1I"
|
|
|
|
case CoreName => "Rocket" })))
|
2015-10-06 06:48:05 +02:00
|
|
|
val dcache = Module(new HellaCache()(dcacheParams))
|
2015-10-21 00:02:24 +02:00
|
|
|
val ptw = Module(new PTW(nPTWPorts)(dcacheParams))
|
2014-08-08 21:23:02 +02:00
|
|
|
|
2015-04-11 11:26:33 +02:00
|
|
|
dcache.io.cpu.invalidate_lr := core.io.dmem.invalidate_lr // Bypass signal to dcache
|
2015-10-21 00:02:24 +02:00
|
|
|
val dcArb = Module(new HellaCacheArbiter(nDCachePorts)(dcacheParams))
|
2014-08-08 21:23:02 +02:00
|
|
|
dcArb.io.requestor(0) <> ptw.io.mem
|
|
|
|
dcArb.io.requestor(1) <> core.io.dmem
|
2015-08-02 06:11:25 +02:00
|
|
|
dcache.io.cpu <> dcArb.io.mem
|
2012-03-25 00:56:59 +01:00
|
|
|
|
2015-03-04 01:40:39 +01:00
|
|
|
ptw.io.requestor(0) <> icache.io.ptw
|
|
|
|
ptw.io.requestor(1) <> dcache.io.ptw
|
2013-09-13 07:34:38 +02:00
|
|
|
|
2015-08-02 06:11:25 +02:00
|
|
|
io.host <> core.io.host
|
|
|
|
icache.io.cpu <> core.io.imem
|
2013-09-15 07:34:53 +02:00
|
|
|
core.io.ptw <> ptw.io.dpath
|
|
|
|
|
2015-07-22 02:10:56 +02:00
|
|
|
//If so specified, build an FPU module and wire it in
|
2015-10-21 00:02:24 +02:00
|
|
|
if (p(UseFPU)) core.io.fpu <> Module(new FPU()(p)).io
|
2015-07-22 02:10:56 +02:00
|
|
|
|
2015-10-21 00:02:24 +02:00
|
|
|
// Connect the caches and ROCC to the outer memory system
|
|
|
|
io.cached.head <> dcache.io.mem
|
|
|
|
// If so specified, build an RoCC module and wire it to core + TileLink ports,
|
|
|
|
// otherwise just hookup the icache
|
2015-11-26 01:02:27 +01:00
|
|
|
io.uncached <> (if (usingRocc) {
|
|
|
|
val iMemArb = Module(new ClientTileLinkIOArbiter(1 + nRocc))
|
2015-10-21 00:02:24 +02:00
|
|
|
iMemArb.io.in(0) <> icache.io.mem
|
2015-11-26 01:02:27 +01:00
|
|
|
|
|
|
|
val respArb = Module(new RRArbiter(new RoCCResponse, nRocc))
|
|
|
|
core.io.rocc.resp <> respArb.io.out
|
|
|
|
|
|
|
|
val cmdRouter = Module(new RoccCommandRouter(roccOpcodes))
|
|
|
|
cmdRouter.io.in <> core.io.rocc.cmd
|
|
|
|
|
|
|
|
val roccs = buildRocc.zip(roccMemChannels).zipWithIndex.map {
|
|
|
|
case ((buildItHere, nchannels), i) =>
|
|
|
|
val accelParams = p.alterPartial({ case RoccNMemChannels => nchannels})
|
|
|
|
val rocc = buildItHere(accelParams)
|
|
|
|
val dcIF = Module(new SimpleHellaCacheIF()(dcacheParams))
|
|
|
|
rocc.io.cmd <> cmdRouter.io.out(i)
|
|
|
|
rocc.io.s := core.io.rocc.s
|
|
|
|
rocc.io.exception := core.io.rocc.exception
|
|
|
|
dcIF.io.requestor <> rocc.io.mem
|
|
|
|
dcArb.io.requestor(2 + i) <> dcIF.io.cache
|
|
|
|
iMemArb.io.in(1 + i) <> rocc.io.imem
|
|
|
|
ptw.io.requestor(2 + 3 * i) <> rocc.io.iptw
|
|
|
|
ptw.io.requestor(3 + 3 * i) <> rocc.io.dptw
|
|
|
|
ptw.io.requestor(4 + 3 * i) <> rocc.io.pptw
|
|
|
|
rocc
|
|
|
|
}
|
|
|
|
|
|
|
|
core.io.rocc.busy := cmdRouter.io.busy || roccs.map(_.io.busy).reduce(_ || _)
|
|
|
|
core.io.rocc.interrupt := roccs.map(_.io.interrupt).reduce(_ || _)
|
|
|
|
respArb.io.in <> roccs.map(rocc => Queue(rocc.io.resp))
|
|
|
|
|
|
|
|
roccs.flatMap(_.io.dmem) :+ iMemArb.io.out
|
|
|
|
} else { Seq(icache.io.mem) })
|
2012-03-25 00:56:59 +01:00
|
|
|
}
|