Heterogeneous Tiles (#550)
Fundamental new features: * Added tile package: This package is intended to hold components re-usable across different types of tile. Will be the future location of TL2-RoCC accelerators and new diplomatic versions of intra-tile interfaces. * Adopted [ModuleName]Params convention: Code base was very inconsistent about what to name case classes that provide parameters to modules. Settled on calling them [ModuleName]Params to distinguish them from config.Parameters and config.Config. So far applied mostly only to case classes defined within rocket and tile. * Defined RocketTileParams: A nested case class containing case classes for all the components of a tile (L1 caches and core). Allows all such parameters to vary per-tile. * Defined RocketCoreParams: All the parameters that can be varied per-core. * Defined L1CacheParams: A trait defining the parameters common to L1 caches, made concrete in different derived case classes. * Defined RocketTilesKey: A sequence of RocketTileParams, one for every tile to be created. * Provided HeterogeneousDualCoreConfig: An example of making a heterogeneous chip with two cores, one big and one little. * Changes to legacy code: ReplacementPolicy moved to package util. L1Metadata moved to package tile. Legacy L2 cache agent removed because it can no longer share the metadata array implementation with the L1. Legacy GroundTests on life support. Additional changes that got rolled in along the way: * rocket: Fix critical path through BTB for I$ index bits > pgIdxBits * coreplex: tiles connected via :=* * groundtest: updated to use TileParams * tilelink: cache cork requirements are relaxed to allow more cacheless masters
This commit is contained in:
@ -4,23 +4,33 @@
|
||||
package groundtest
|
||||
|
||||
import Chisel._
|
||||
import coreplex.BareTile
|
||||
import config._
|
||||
import coreplex._
|
||||
import rocket._
|
||||
import tile._
|
||||
import uncore.tilelink._
|
||||
import uncore.util.CacheName
|
||||
import uncore.tilelink2._
|
||||
import rocketchip.ExtMem
|
||||
import diplomacy._
|
||||
import scala.util.Random
|
||||
import scala.collection.mutable.ListBuffer
|
||||
import util.ParameterizedBundle
|
||||
import config._
|
||||
|
||||
import scala.collection.mutable.ListBuffer
|
||||
|
||||
case object BuildGroundTest extends Field[Parameters => GroundTest]
|
||||
|
||||
case class GroundTestTileSettings(
|
||||
uncached: Int = 0, cached: Int = 0, ptw: Int = 0, maxXacts: Int = 1)
|
||||
case object GroundTestKey extends Field[Seq[GroundTestTileSettings]]
|
||||
case class GroundTestTileParams(
|
||||
uncached: Int = 0,
|
||||
ptw: Int = 0,
|
||||
maxXacts: Int = 1,
|
||||
dcache: Option[DCacheParams] = Some(DCacheParams())) extends TileParams {
|
||||
val icache = None
|
||||
val btb = None
|
||||
val rocc = Nil
|
||||
val core = rocket.RocketCoreParams() //TODO remove this
|
||||
val cached = if(dcache.isDefined) 1 else 0
|
||||
val dataScratchpadBytes = 0
|
||||
}
|
||||
case object GroundTestKey extends Field[Seq[GroundTestTileParams]]
|
||||
|
||||
trait HasGroundTestConstants {
|
||||
val timeoutCodeBits = 4
|
||||
@ -29,61 +39,14 @@ trait HasGroundTestConstants {
|
||||
|
||||
trait HasGroundTestParameters {
|
||||
implicit val p: Parameters
|
||||
val tileSettings = p(GroundTestKey)(p(TileId))
|
||||
val nUncached = tileSettings.uncached
|
||||
val nCached = tileSettings.cached
|
||||
val nPTW = tileSettings.ptw
|
||||
val tileParams = p(GroundTestKey)(p(TileId))
|
||||
val nUncached = tileParams.uncached
|
||||
val nCached = tileParams.cached
|
||||
val nPTW = tileParams.ptw
|
||||
val memStart = p(ExtMem).base
|
||||
val memStartBlock = memStart >> p(CacheBlockOffsetBits)
|
||||
}
|
||||
|
||||
class DummyPTW(n: Int)(implicit p: Parameters) extends CoreModule()(p) {
|
||||
val io = new Bundle {
|
||||
val requestors = Vec(n, new TLBPTWIO).flip
|
||||
}
|
||||
|
||||
val req_arb = Module(new RRArbiter(new PTWReq, n))
|
||||
req_arb.io.in <> io.requestors.map(_.req)
|
||||
req_arb.io.out.ready := Bool(true)
|
||||
|
||||
def vpn_to_ppn(vpn: UInt): UInt = vpn(ppnBits - 1, 0)
|
||||
|
||||
class QueueChannel extends ParameterizedBundle()(p) {
|
||||
val ppn = UInt(width = ppnBits)
|
||||
val chosen = UInt(width = log2Up(n))
|
||||
}
|
||||
|
||||
val s1_ppn = vpn_to_ppn(req_arb.io.out.bits.addr)
|
||||
val s2_ppn = RegEnable(s1_ppn, req_arb.io.out.valid)
|
||||
val s2_chosen = RegEnable(req_arb.io.chosen, req_arb.io.out.valid)
|
||||
val s2_valid = Reg(next = req_arb.io.out.valid)
|
||||
|
||||
val s2_resp = Wire(new PTWResp)
|
||||
s2_resp.pte.ppn := s2_ppn
|
||||
s2_resp.pte.reserved_for_software := UInt(0)
|
||||
s2_resp.pte.d := Bool(true)
|
||||
s2_resp.pte.a := Bool(false)
|
||||
s2_resp.pte.g := Bool(false)
|
||||
s2_resp.pte.u := Bool(true)
|
||||
s2_resp.pte.r := Bool(true)
|
||||
s2_resp.pte.w := Bool(true)
|
||||
s2_resp.pte.x := Bool(false)
|
||||
s2_resp.pte.v := Bool(true)
|
||||
|
||||
io.requestors.zipWithIndex.foreach { case (requestor, i) =>
|
||||
requestor.resp.valid := s2_valid && s2_chosen === UInt(i)
|
||||
requestor.resp.bits := s2_resp
|
||||
requestor.status.vm := UInt("b01000")
|
||||
requestor.status.prv := UInt(PRV.S)
|
||||
requestor.status.debug := Bool(false)
|
||||
requestor.status.mprv := Bool(true)
|
||||
requestor.status.mpp := UInt(0)
|
||||
requestor.ptbr.asid := UInt(0)
|
||||
requestor.ptbr.ppn := UInt(0)
|
||||
requestor.invalidate := Bool(false)
|
||||
}
|
||||
}
|
||||
|
||||
class GroundTestStatus extends Bundle with HasGroundTestConstants {
|
||||
val finished = Bool(OUTPUT)
|
||||
val timeout = Valid(UInt(width = timeoutCodeBits))
|
||||
@ -103,38 +66,33 @@ abstract class GroundTest(implicit val p: Parameters) extends Module
|
||||
val io = new GroundTestIO
|
||||
}
|
||||
|
||||
class GroundTestTile(implicit p: Parameters) extends LazyModule with HasGroundTestParameters {
|
||||
val dcacheParams = p.alterPartial {
|
||||
case CacheName => CacheName("L1D")
|
||||
}
|
||||
class GroundTestTile(implicit p: Parameters) extends LazyModule
|
||||
with HasGroundTestParameters {
|
||||
val slave = None
|
||||
val dcache = HellaCache(p(DCacheKey))(dcacheParams)
|
||||
val dcacheOpt = tileParams.dcache.map { dc => HellaCache(dc.nMSHRs == 0) }
|
||||
val ucLegacy = LazyModule(new TLLegacy)
|
||||
|
||||
val cachedOut = TLOutputNode()
|
||||
val uncachedOut = TLOutputNode()
|
||||
cachedOut := dcache.node
|
||||
uncachedOut := TLHintHandler()(ucLegacy.node)
|
||||
val masterNodes = List(cachedOut, uncachedOut)
|
||||
val masterNode = TLOutputNode()
|
||||
dcacheOpt.foreach { masterNode := _.node }
|
||||
masterNode := TLHintHandler()(ucLegacy.node)
|
||||
|
||||
lazy val module = new LazyModuleImp(this) {
|
||||
val io = new Bundle {
|
||||
val cached = cachedOut.bundleOut
|
||||
val uncached = uncachedOut.bundleOut
|
||||
val out = masterNode.bundleOut
|
||||
val success = Bool(OUTPUT)
|
||||
}
|
||||
|
||||
val test = p(BuildGroundTest)(dcacheParams)
|
||||
val test = p(BuildGroundTest)(p)
|
||||
|
||||
val ptwPorts = ListBuffer.empty ++= test.io.ptw
|
||||
val uncachedArbPorts = ListBuffer.empty ++= test.io.mem
|
||||
|
||||
if (nCached > 0) {
|
||||
val dcacheArb = Module(new HellaCacheArbiter(nCached)(dcacheParams))
|
||||
dcacheOpt foreach { dcache =>
|
||||
val dcacheArb = Module(new HellaCacheArbiter(nCached))
|
||||
|
||||
dcacheArb.io.requestor.zip(test.io.cache).foreach {
|
||||
case (requestor, cache) =>
|
||||
val dcacheIF = Module(new SimpleHellaCacheIF()(dcacheParams))
|
||||
val dcacheIF = Module(new SimpleHellaCacheIF())
|
||||
dcacheIF.io.requestor <> cache
|
||||
requestor <> dcacheIF.io.cache
|
||||
}
|
||||
@ -147,7 +105,7 @@ class GroundTestTile(implicit p: Parameters) extends LazyModule with HasGroundTe
|
||||
}
|
||||
|
||||
if (ptwPorts.size > 0) {
|
||||
val ptw = Module(new DummyPTW(ptwPorts.size)(dcacheParams))
|
||||
val ptw = Module(new DummyPTW(ptwPorts.size))
|
||||
ptw.io.requestors <> ptwPorts
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user