1
0

Merge branch 'param-refactor-tl'

This commit is contained in:
Henry Cook 2015-10-14 12:16:22 -07:00
commit 4270fd78a5
9 changed files with 208 additions and 210 deletions

@ -1 +1 @@
Subproject commit 70a5971a223380f9334105aa715ba38fad9ef5f2 Subproject commit 5f099ddb2186687d3e309e870676e63c8844e7e0

2
rocket

@ -1 +1 @@
Subproject commit ca26680973158727c4c7dcbff0d3054b988d5f7a Subproject commit 4d29d5c48cfaa3800bf5b6d5428a9c6e83335477

View File

@ -15,25 +15,22 @@ class DefaultConfig extends ChiselConfig (
topDefinitions = { (pname,site,here) => topDefinitions = { (pname,site,here) =>
type PF = PartialFunction[Any,Any] type PF = PartialFunction[Any,Any]
def findBy(sname:Any):Any = here[PF](site[Any](sname))(pname) def findBy(sname:Any):Any = here[PF](site[Any](sname))(pname)
def genCsrAddrMap() = { def genCsrAddrMap: AddrMap = {
val xLen = site(XLen) val csrSize = (1 << 12) * (site(XLen) / 8)
val nSCR = site(HTIFNSCR) val csrs = (0 until site(NTiles)).map{ i =>
val csrSize = (1 << 12) * (xLen / 8) AddrMapEntry(s"csr$i", None, MemSize(csrSize, AddrMapConsts.RW))
val nTiles = site(NTiles) }
val scrSize = site(HtifKey).nSCR * (site(XLen) / 8)
(0 until nTiles) val scr = AddrMapEntry("scr", None, MemSize(scrSize, AddrMapConsts.RW))
.map(i => (s"csr$i", None, MemSize(csrSize, AddrMap.RW))) :+ new AddrMap(csrs :+ scr)
("scr", None, MemSize(nSCR * xLen / 8, AddrMap.RW))
} }
pname match { pname match {
//
case UseZscale => false case UseZscale => false
//HTIF Parameters case HtifKey => HtifParameters(
case HTIFWidth => Dump("HTIF_WIDTH", 16) width = Dump("HTIF_WIDTH", 16),
case HTIFNSCR => 64 nSCR = 64,
case HTIFSCRDataBits => site(XLen) offsetBits = site(CacheBlockOffsetBits),
case HTIFOffsetBits => site(CacheBlockOffsetBits) nCores = site(NTiles))
case HTIFNCores => site(NTiles)
//Memory Parameters //Memory Parameters
case PAddrBits => 32 case PAddrBits => 32
case PgIdxBits => 12 case PgIdxBits => 12
@ -50,9 +47,10 @@ class DefaultConfig extends ChiselConfig (
case MIFDataBits => Dump("MEM_DATA_BITS", 128) case MIFDataBits => Dump("MEM_DATA_BITS", 128)
case MIFAddrBits => Dump("MEM_ADDR_BITS", site(PAddrBits) - site(CacheBlockOffsetBits)) case MIFAddrBits => Dump("MEM_ADDR_BITS", site(PAddrBits) - site(CacheBlockOffsetBits))
case MIFDataBeats => site(CacheBlockBytes) * 8 / site(MIFDataBits) case MIFDataBeats => site(CacheBlockBytes) * 8 / site(MIFDataBits)
case NASTIDataBits => site(MIFDataBits) case NastiKey => NastiParameters(
case NASTIAddrBits => site(PAddrBits) dataBits = site(MIFDataBits),
case NASTIIdBits => site(MIFTagBits) addrBits = site(PAddrBits),
idBits = site(MIFTagBits))
//Params used by all caches //Params used by all caches
case NSets => findBy(CacheName) case NSets => findBy(CacheName)
case NWays => findBy(CacheName) case NWays => findBy(CacheName)
@ -74,8 +72,7 @@ class DefaultConfig extends ChiselConfig (
case Replacer => () => new RandomReplacement(site(NWays)) case Replacer => () => new RandomReplacement(site(NWays))
case AmoAluOperandBits => site(XLen) case AmoAluOperandBits => site(XLen)
//L1InstCache //L1InstCache
case NBTBEntries => 62 case BtbKey => BtbParameters()
case NRAS => 2
//L1DataCache //L1DataCache
case WordBits => site(XLen) case WordBits => site(XLen)
case StoreDataQueueDepth => 17 case StoreDataQueueDepth => 17
@ -86,15 +83,19 @@ class DefaultConfig extends ChiselConfig (
//L2 Memory System Params //L2 Memory System Params
case NAcquireTransactors => 7 case NAcquireTransactors => 7
case L2StoreDataQueueDepth => 1 case L2StoreDataQueueDepth => 1
case L2DirectoryRepresentation => new NullRepresentation(site(TLNCachingClients)) case L2DirectoryRepresentation => new NullRepresentation(site(NTiles))
case BuildL2CoherenceManager => () => case BuildL2CoherenceManager => (p: Parameters) =>
Module(new L2BroadcastHub, { case InnerTLId => "L1ToL2"; case OuterTLId => "L2ToMC" }) Module(new L2BroadcastHub()(p.alterPartial({
case InnerTLId => "L1toL2"
case OuterTLId => "L2toMC" })))
//Tile Constants //Tile Constants
case BuildTiles => { case BuildTiles => {
TestGeneration.addSuites(rv64i.map(_("p"))) TestGeneration.addSuites(rv64i.map(_("p")))
TestGeneration.addSuites((if(site(UseVM)) List("pt","v") else List("pt")).flatMap(env => rv64u.map(_(env)))) TestGeneration.addSuites((if(site(UseVM)) List("pt","v") else List("pt")).flatMap(env => rv64u.map(_(env))))
TestGeneration.addSuites(if(site(NTiles) > 1) List(mtBmarks, bmarks) else List(bmarks)) TestGeneration.addSuites(if(site(NTiles) > 1) List(mtBmarks, bmarks) else List(bmarks))
List.fill(site(NTiles)){ (r:Bool) => Module(new RocketTile(resetSignal = r), {case TLId => "L1ToL2"}) } List.fill(site(NTiles)){ (r: Bool, p: Parameters) =>
Module(new RocketTile(resetSignal = r)(p.alterPartial({case TLId => "L1toL2"})))
}
} }
case BuildRoCC => None case BuildRoCC => None
case NDCachePorts => 2 + (if(site(BuildRoCC).isEmpty) 0 else 1) case NDCachePorts => 2 + (if(site(BuildRoCC).isEmpty) 0 else 1)
@ -108,12 +109,11 @@ class DefaultConfig extends ChiselConfig (
case FastLoadByte => false case FastLoadByte => false
case FastMulDiv => true case FastMulDiv => true
case XLen => 64 case XLen => 64
case NMultXpr => 32
case BuildFPU => { case BuildFPU => {
val env = if(site(UseVM)) List("p","pt","v") else List("p","pt") val env = if(site(UseVM)) List("p","pt","v") else List("p","pt")
if(site(FDivSqrt)) TestGeneration.addSuites(env.map(rv64uf)) if(site(FDivSqrt)) TestGeneration.addSuites(env.map(rv64uf))
else TestGeneration.addSuites(env.map(rv64ufNoDiv)) else TestGeneration.addSuites(env.map(rv64ufNoDiv))
Some(() => Module(new FPU)) Some((p: Parameters) => Module(new FPU()(p)))
} }
case FDivSqrt => true case FDivSqrt => true
case SFMALatency => 2 case SFMALatency => 2
@ -124,41 +124,34 @@ class DefaultConfig extends ChiselConfig (
case NCustomMRWCSRs => 0 case NCustomMRWCSRs => 0
//Uncore Paramters //Uncore Paramters
case RTCPeriod => 100 // gives 10 MHz RTC assuming 1 GHz uncore clock case RTCPeriod => 100 // gives 10 MHz RTC assuming 1 GHz uncore clock
case LNEndpoints => site(TLNManagers) + site(TLNClients) case LNEndpoints => site(TLKey(site(TLId))).nManagers + site(TLKey(site(TLId))).nClients
case LNHeaderBits => log2Ceil(site(TLNManagers)) + log2Up(site(TLNClients)) case LNHeaderBits => log2Ceil(site(TLKey(site(TLId))).nManagers) +
case TLBlockAddrBits => site(PAddrBits) - site(CacheBlockOffsetBits) log2Up(site(TLKey(site(TLId))).nClients)
case TLNClients => site(TLNCachingClients) + site(TLNCachelessClients) case TLKey("L1toL2") =>
case TLDataBits => site(CacheBlockBytes)*8/site(TLDataBeats) TileLinkParameters(
case TLDataBeats => 4 coherencePolicy = new MESICoherence(site(L2DirectoryRepresentation)),
case TLWriteMaskBits => (site(TLDataBits) - 1) / 8 + 1 nManagers = site(NBanksPerMemoryChannel)*site(NMemoryChannels),
case TLNetworkIsOrderedP2P => false nCachingClients = site(NTiles),
case TLNManagers => findBy(TLId) nCachelessClients = site(NTiles) + 1,
case TLNCachingClients => findBy(TLId) maxClientXacts = max(site(NMSHRs) + site(NIOMSHRs),
case TLNCachelessClients => findBy(TLId) if(site(BuildRoCC).isEmpty) 1
case TLCoherencePolicy => findBy(TLId) else site(RoCCMaxTaggedMemXacts)),
case TLMaxManagerXacts => findBy(TLId) maxClientsPerPort = if(site(BuildRoCC).isEmpty) 1 else 3,
case TLMaxClientXacts => findBy(TLId) maxManagerXacts = site(NAcquireTransactors) + 2,
case TLMaxClientsPerPort => findBy(TLId) addrBits = site(PAddrBits) - site(CacheBlockOffsetBits),
case "L1ToL2" => { dataBits = site(CacheBlockBytes)*8)()
case TLNManagers => site(NBanksPerMemoryChannel)*site(NMemoryChannels) case TLKey("L2toMC") =>
case TLNCachingClients => site(NTiles) TileLinkParameters(
case TLNCachelessClients => site(NTiles) + 1 coherencePolicy = new MEICoherence(new NullRepresentation(site(NBanksPerMemoryChannel))),
case TLCoherencePolicy => new MESICoherence(site(L2DirectoryRepresentation)) nManagers = 1,
case TLMaxManagerXacts => site(NAcquireTransactors) + 2 nCachingClients = site(NBanksPerMemoryChannel),
case TLMaxClientXacts => max(site(NMSHRs) + site(NIOMSHRs), nCachelessClients = 0,
if(site(BuildRoCC).isEmpty) 1 maxClientXacts = 1,
else site(RoCCMaxTaggedMemXacts)) maxClientsPerPort = site(NAcquireTransactors) + 2,
case TLMaxClientsPerPort => if(site(BuildRoCC).isEmpty) 1 else 3 maxManagerXacts = 1,
}:PF addrBits = site(PAddrBits) - site(CacheBlockOffsetBits),
case "L2ToMC" => { dataBits = site(CacheBlockBytes)*8)()
case TLNManagers => 1 case TLKey("Outermost") => site(TLKey("L2toMC"))
case TLNCachingClients => site(NBanksPerMemoryChannel)
case TLNCachelessClients => 0
case TLCoherencePolicy => new MEICoherence(new NullRepresentation(site(NBanksPerMemoryChannel)))
case TLMaxManagerXacts => 1
case TLMaxClientXacts => 1
case TLMaxClientsPerPort => site(NAcquireTransactors) + 2
}:PF
case NTiles => Knob("NTILES") case NTiles => Knob("NTILES")
case NMemoryChannels => 1 case NMemoryChannels => 1
case NBanksPerMemoryChannel => Knob("NBANKS") case NBanksPerMemoryChannel => Knob("NBANKS")
@ -169,15 +162,10 @@ class DefaultConfig extends ChiselConfig (
case UseBackupMemoryPort => true case UseBackupMemoryPort => true
case MMIOBase => BigInt(1 << 30) // 1 GB case MMIOBase => BigInt(1 << 30) // 1 GB
case ExternalIOStart => 2 * site(MMIOBase) case ExternalIOStart => 2 * site(MMIOBase)
case NASTIAddrMap => Seq( case GlobalAddrMap => AddrMap(
("mem", None, MemSize(site(MMIOBase), AddrMap.RWX)), AddrMapEntry("mem", None, MemSize(site(MMIOBase), AddrMapConsts.RWX)),
("conf", None, MemSubmap(site(ExternalIOStart) - site(MMIOBase), AddrMapEntry("conf", None, MemSubmap(site(ExternalIOStart) - site(MMIOBase), genCsrAddrMap)),
genCsrAddrMap())), AddrMapEntry("io", Some(site(ExternalIOStart)), MemSize(2 * site(MMIOBase), AddrMapConsts.RW)))
("io", Some(site(ExternalIOStart)),
MemSize(2 * site(MMIOBase), AddrMap.RW)))
case NASTIAddrHashMap => new AddrHashMap(site(NASTIAddrMap))
case NASTINMasters => site(TLNManagers) + 1
case NASTINSlaves => site(NASTIAddrHashMap).nEntries
}}, }},
knobValues = { knobValues = {
case "NTILES" => 1 case "NTILES" => 1
@ -209,16 +197,16 @@ class WithL2Cache extends ChiselConfig(
site(NBanksPerMemoryChannel)*site(NMemoryChannels)) / site(NBanksPerMemoryChannel)*site(NMemoryChannels)) /
site(NWays) site(NWays)
case NWays => Knob("L2_WAYS") case NWays => Knob("L2_WAYS")
case RowBits => site(TLDataBits) case RowBits => site(TLKey(site(TLId))).dataBits
}: PartialFunction[Any,Any] }: PartialFunction[Any,Any]
case NAcquireTransactors => 2 case NAcquireTransactors => 2
case NSecondaryMisses => 4 case NSecondaryMisses => 4
case L2DirectoryRepresentation => new FullRepresentation(site(TLNCachingClients)) case L2DirectoryRepresentation => new FullRepresentation(site(NTiles))
case BuildL2CoherenceManager => () => case BuildL2CoherenceManager => (p: Parameters) =>
Module(new L2HellaCacheBank, { Module(new L2HellaCacheBank()(p.alterPartial({
case CacheName => "L2Bank" case CacheName => "L2Bank"
case InnerTLId => "L1ToL2" case InnerTLId => "L1toL2"
case OuterTLId => "L2ToMC"}) case OuterTLId => "L2toMC"})))
}, },
knobValues = { case "L2_WAYS" => 8; case "L2_CAPACITY_IN_KB" => 2048 } knobValues = { case "L2_WAYS" => 8; case "L2_CAPACITY_IN_KB" => 2048 }
) )
@ -240,7 +228,7 @@ class WithZscale extends ChiselConfig(
case BuildZscale => { case BuildZscale => {
TestGeneration.addSuites(List(rv32ui("p"), rv32um("p"))) TestGeneration.addSuites(List(rv32ui("p"), rv32um("p")))
TestGeneration.addSuites(List(zscaleBmarks)) TestGeneration.addSuites(List(zscaleBmarks))
(r: Bool) => Module(new Zscale(r), {case TLId => "L1ToL2"}) (r: Bool, p: Parameters) => Module(new Zscale(r)(p.alterPartial({case TLId => "L1toL2"})))
} }
case UseZscale => true case UseZscale => true
case BootROMCapacity => Dump("BOOT_CAPACITY", 16*1024) case BootROMCapacity => Dump("BOOT_CAPACITY", 16*1024)
@ -264,7 +252,7 @@ class SmallConfig extends ChiselConfig (
case BuildFPU => None case BuildFPU => None
case FastMulDiv => false case FastMulDiv => false
case NTLBEntries => 4 case NTLBEntries => 4
case NBTBEntries => 8 case BtbKey => BtbParameters(nEntries = 8)
}}, }},
knobValues = { knobValues = {
case "L1D_SETS" => 64 case "L1D_SETS" => 64

View File

@ -26,12 +26,13 @@ import uncore._
* each channel on the manager side of the network * each channel on the manager side of the network
*/ */
abstract class RocketChipNetwork( abstract class RocketChipNetwork(
addrToManagerId: UInt => UInt, addrToManagerId: UInt => UInt,
sharerToClientId: UInt => UInt, sharerToClientId: UInt => UInt,
clientDepths: TileLinkDepths, clientDepths: TileLinkDepths,
managerDepths: TileLinkDepths) extends TLModule { managerDepths: TileLinkDepths)
val nClients = params(TLNClients) (implicit p: Parameters) extends TLModule()(p) {
val nManagers = params(TLNManagers) val nClients = tlNClients
val nManagers = tlNManagers
val io = new Bundle { val io = new Bundle {
val clients = Vec(new ClientTileLinkIO, nClients).flip val clients = Vec(new ClientTileLinkIO, nClients).flip
val managers = Vec(new ManagerTileLinkIO, nManagers).flip val managers = Vec(new ManagerTileLinkIO, nManagers).flip
@ -39,21 +40,21 @@ abstract class RocketChipNetwork(
val clients = io.clients.zipWithIndex.map { val clients = io.clients.zipWithIndex.map {
case (c, i) => { case (c, i) => {
val p = Module(new ClientTileLinkNetworkPort(i, addrToManagerId)) val port = Module(new ClientTileLinkNetworkPort(i, addrToManagerId))
val q = Module(new TileLinkEnqueuer(clientDepths)) val qs = Module(new TileLinkEnqueuer(clientDepths))
p.io.client <> c port.io.client <> c
q.io.client <> p.io.network qs.io.client <> port.io.network
q.io.manager qs.io.manager
} }
} }
val managers = io.managers.zipWithIndex.map { val managers = io.managers.zipWithIndex.map {
case (m, i) => { case (m, i) => {
val p = Module(new ManagerTileLinkNetworkPort(i, sharerToClientId)) val port = Module(new ManagerTileLinkNetworkPort(i, sharerToClientId))
val q = Module(new TileLinkEnqueuer(managerDepths)) val qs = Module(new TileLinkEnqueuer(managerDepths))
p.io.manager <> m port.io.manager <> m
p.io.network <> q.io.manager port.io.network <> qs.io.manager
q.io.client qs.io.client
} }
} }
} }
@ -61,10 +62,11 @@ abstract class RocketChipNetwork(
/** A simple arbiter for each channel that also deals with header-based routing. /** A simple arbiter for each channel that also deals with header-based routing.
* Assumes a single manager agent. */ * Assumes a single manager agent. */
class RocketChipTileLinkArbiter( class RocketChipTileLinkArbiter(
sharerToClientId: UInt => UInt = (u: UInt) => u, sharerToClientId: UInt => UInt = (u: UInt) => u,
clientDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0), clientDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0),
managerDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0)) managerDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0))
extends RocketChipNetwork(u => UInt(0), sharerToClientId, clientDepths, managerDepths) (implicit p: Parameters)
extends RocketChipNetwork(u => UInt(0), sharerToClientId, clientDepths, managerDepths)(p)
with TileLinkArbiterLike with TileLinkArbiterLike
with PassesId { with PassesId {
val arbN = nClients val arbN = nClients
@ -86,13 +88,14 @@ class RocketChipTileLinkArbiter(
* port id are done automatically. * port id are done automatically.
*/ */
class RocketChipTileLinkCrossbar( class RocketChipTileLinkCrossbar(
addrToManagerId: UInt => UInt = u => UInt(0), addrToManagerId: UInt => UInt = u => UInt(0),
sharerToClientId: UInt => UInt = u => u, sharerToClientId: UInt => UInt = u => u,
clientDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0), clientDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0),
managerDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0)) managerDepths: TileLinkDepths = TileLinkDepths(0,0,0,0,0))
extends RocketChipNetwork(addrToManagerId, sharerToClientId, clientDepths, managerDepths) { (implicit p: Parameters)
val n = params(LNEndpoints) extends RocketChipNetwork(addrToManagerId, sharerToClientId, clientDepths, managerDepths)(p) {
val count = params(TLDataBeats) val n = p(LNEndpoints)
val count = tlDataBeats
// Actually instantiate the particular networks required for TileLink // Actually instantiate the particular networks required for TileLink
val acqNet = Module(new BasicCrossbar(n, new Acquire, count, Some((a: PhysicalNetworkIO[Acquire]) => a.payload.hasMultibeatData()))) val acqNet = Module(new BasicCrossbar(n, new Acquire, count, Some((a: PhysicalNetworkIO[Acquire]) => a.payload.hasMultibeatData())))
val relNet = Module(new BasicCrossbar(n, new Release, count, Some((r: PhysicalNetworkIO[Release]) => r.payload.hasMultibeatData()))) val relNet = Module(new BasicCrossbar(n, new Release, count, Some((r: PhysicalNetworkIO[Release]) => r.payload.hasMultibeatData())))

View File

@ -23,27 +23,31 @@ case object NOutstandingMemReqsPerChannel extends Field[Int]
/** Whether to use the slow backup memory port [VLSI] */ /** Whether to use the slow backup memory port [VLSI] */
case object UseBackupMemoryPort extends Field[Boolean] case object UseBackupMemoryPort extends Field[Boolean]
/** Function for building some kind of coherence manager agent */ /** Function for building some kind of coherence manager agent */
case object BuildL2CoherenceManager extends Field[() => CoherenceAgent] case object BuildL2CoherenceManager extends Field[Parameters => CoherenceAgent]
/** Function for building some kind of tile connected to a reset signal */ /** Function for building some kind of tile connected to a reset signal */
case object BuildTiles extends Field[Seq[(Bool) => Tile]] case object BuildTiles extends Field[Seq[(Bool, Parameters) => Tile]]
/** Start address of the "io" region in the memory map */ /** Start address of the "io" region in the memory map */
case object ExternalIOStart extends Field[BigInt] case object ExternalIOStart extends Field[BigInt]
/** Utility trait for quick access to some relevant parameters */ /** Utility trait for quick access to some relevant parameters */
trait TopLevelParameters extends UsesParameters { trait HasTopLevelParameters {
val htifW = params(HTIFWidth) implicit val p: Parameters
val nTiles = params(NTiles) lazy val nTiles = p(NTiles)
val nMemChannels = params(NMemoryChannels) lazy val htifW = p(HtifKey).width
val nBanksPerMemChannel = params(NBanksPerMemoryChannel) lazy val csrAddrBits = 12
val nBanks = nMemChannels*nBanksPerMemChannel lazy val nMemChannels = p(NMemoryChannels)
val lsb = params(BankIdLSB) lazy val nBanksPerMemChannel = p(NBanksPerMemoryChannel)
val nMemReqs = params(NOutstandingMemReqsPerChannel) lazy val nBanks = nMemChannels*nBanksPerMemChannel
val mifAddrBits = params(MIFAddrBits) lazy val lsb = p(BankIdLSB)
val mifDataBeats = params(MIFDataBeats) lazy val nMemReqs = p(NOutstandingMemReqsPerChannel)
val scrAddrBits = log2Up(params(HTIFNSCR)) lazy val mifAddrBits = p(MIFAddrBits)
val pcrAddrBits = 12 lazy val mifDataBeats = p(MIFDataBeats)
val xLen = params(XLen) lazy val xLen = p(XLen)
require(lsb + log2Up(nBanks) < mifAddrBits) lazy val nSCR = p(HtifKey).nSCR
lazy val scrAddrBits = log2Up(nSCR)
lazy val scrDataBits = 64
lazy val scrDataBytes = scrDataBits / 8
//require(lsb + log2Up(nBanks) < mifAddrBits)
} }
class MemBackupCtrlIO extends Bundle { class MemBackupCtrlIO extends Bundle {
@ -54,28 +58,30 @@ class MemBackupCtrlIO extends Bundle {
} }
/** Top-level io for the chip */ /** Top-level io for the chip */
class BasicTopIO extends Bundle { class BasicTopIO(implicit val p: Parameters) extends ParameterizedBundle()(p)
val host = new HostIO with HasTopLevelParameters {
val host = new HostIO(htifW)
val mem_backup_ctrl = new MemBackupCtrlIO val mem_backup_ctrl = new MemBackupCtrlIO
} }
class TopIO extends BasicTopIO { class TopIO(implicit p: Parameters) extends BasicTopIO()(p) {
val mem = new MemIO val mem = new MemIO
} }
class MultiChannelTopIO extends BasicTopIO with TopLevelParameters { class MultiChannelTopIO(implicit p: Parameters) extends BasicTopIO()(p) {
val mem = Vec(new NASTIIO, nMemChannels) val mem = Vec(new NastiIO, nMemChannels)
val mmio = new NASTIIO val mmio = new NastiIO
} }
/** Top-level module for the chip */ /** Top-level module for the chip */
//TODO: Remove this wrapper once multichannel DRAM controller is provided //TODO: Remove this wrapper once multichannel DRAM controller is provided
class Top extends Module with TopLevelParameters { class Top extends Module with HasTopLevelParameters {
implicit val p = params
val io = new TopIO val io = new TopIO
if(!params(UseZscale)) { if(!p(UseZscale)) {
val temp = Module(new MultiChannelTop) val temp = Module(new MultiChannelTop)
val arb = Module(new NASTIArbiter(nMemChannels)) val arb = Module(new NastiArbiter(nMemChannels))
val conv = Module(new MemIONASTIIOConverter(params(CacheBlockOffsetBits))) val conv = Module(new MemIONastiIOConverter(p(CacheBlockOffsetBits)))
arb.io.master <> temp.io.mem arb.io.master <> temp.io.mem
conv.io.nasti <> arb.io.slave conv.io.nasti <> arb.io.slave
io.mem.req_cmd <> Queue(conv.io.mem.req_cmd) io.mem.req_cmd <> Queue(conv.io.mem.req_cmd)
@ -85,7 +91,7 @@ class Top extends Module with TopLevelParameters {
io.host <> temp.io.host io.host <> temp.io.host
// tie off the mmio port // tie off the mmio port
val errslave = Module(new NASTIErrorSlave) val errslave = Module(new NastiErrorSlave)
errslave.io <> temp.io.mmio errslave.io <> temp.io.mmio
} else { } else {
val temp = Module(new ZscaleTop) val temp = Module(new ZscaleTop)
@ -93,23 +99,24 @@ class Top extends Module with TopLevelParameters {
} }
} }
class MultiChannelTop extends Module with TopLevelParameters { class MultiChannelTop(implicit val p: Parameters) extends Module with HasTopLevelParameters {
val io = new MultiChannelTopIO val io = new MultiChannelTopIO
// Build an Uncore and a set of Tiles // Build an Uncore and a set of Tiles
val uncore = Module(new Uncore, {case TLId => "L1ToL2"}) val innerTLParams = p.alterPartial({case TLId => "L1toL2" })
val tileList = uncore.io.htif zip params(BuildTiles) map { case(hl, bt) => bt(hl.reset) } val uncore = Module(new Uncore()(innerTLParams))
val tileList = uncore.io.htif zip p(BuildTiles) map { case(hl, bt) => bt(hl.reset, p) }
// Connect each tile to the HTIF // Connect each tile to the HTIF
uncore.io.htif.zip(tileList).zipWithIndex.foreach { uncore.io.htif.zip(tileList).zipWithIndex.foreach {
case ((hl, tile), i) => case ((hl, tile), i) =>
tile.io.host.id := UInt(i) tile.io.host.id := UInt(i)
tile.io.host.reset := Reg(next=Reg(next=hl.reset)) tile.io.host.reset := Reg(next=Reg(next=hl.reset))
tile.io.host.pcr.req <> Queue(hl.pcr.req) tile.io.host.csr.req <> Queue(hl.csr.req)
hl.pcr.resp <> Queue(tile.io.host.pcr.resp) hl.csr.resp <> Queue(tile.io.host.csr.resp)
hl.ipi_req <> Queue(tile.io.host.ipi_req) hl.ipi_req <> Queue(tile.io.host.ipi_req)
tile.io.host.ipi_rep <> Queue(hl.ipi_rep) tile.io.host.ipi_rep <> Queue(hl.ipi_rep)
hl.debug_stats_pcr := tile.io.host.debug_stats_pcr hl.debug_stats_csr := tile.io.host.debug_stats_csr
} }
// Connect the uncore to the tile memory ports, HostIO and MemIO // Connect the uncore to the tile memory ports, HostIO and MemIO
@ -118,7 +125,7 @@ class MultiChannelTop extends Module with TopLevelParameters {
io.host <> uncore.io.host io.host <> uncore.io.host
io.mem <> uncore.io.mem io.mem <> uncore.io.mem
io.mmio <> uncore.io.mmio io.mmio <> uncore.io.mmio
if(params(UseBackupMemoryPort)) { io.mem_backup_ctrl <> uncore.io.mem_backup_ctrl } if(p(UseBackupMemoryPort)) { io.mem_backup_ctrl <> uncore.io.mem_backup_ctrl }
} }
/** Wrapper around everything that isn't a Tile. /** Wrapper around everything that isn't a Tile.
@ -126,18 +133,18 @@ class MultiChannelTop extends Module with TopLevelParameters {
* Usually this is clocked and/or place-and-routed separately from the Tiles. * Usually this is clocked and/or place-and-routed separately from the Tiles.
* Contains the Host-Target InterFace module (HTIF). * Contains the Host-Target InterFace module (HTIF).
*/ */
class Uncore extends Module with TopLevelParameters { class Uncore(implicit val p: Parameters) extends Module with HasTopLevelParameters {
val io = new Bundle { val io = new Bundle {
val host = new HostIO val host = new HostIO(htifW)
val mem = Vec(new NASTIIO, nMemChannels) val mem = Vec(new NastiIO, nMemChannels)
val tiles_cached = Vec(new ClientTileLinkIO, nTiles).flip val tiles_cached = Vec(new ClientTileLinkIO, nTiles).flip
val tiles_uncached = Vec(new ClientUncachedTileLinkIO, nTiles).flip val tiles_uncached = Vec(new ClientUncachedTileLinkIO, nTiles).flip
val htif = Vec(new HTIFIO, nTiles).flip val htif = Vec(new HtifIO, nTiles).flip
val mem_backup_ctrl = new MemBackupCtrlIO val mem_backup_ctrl = new MemBackupCtrlIO
val mmio = new NASTIIO val mmio = new NastiIO
} }
val htif = Module(new HTIF(CSRs.mreset)) // One HTIF module per chip val htif = Module(new Htif(CSRs.mreset)) // One HTIF module per chip
val outmemsys = Module(new OuterMemorySystem) // NoC, LLC and SerDes val outmemsys = Module(new OuterMemorySystem) // NoC, LLC and SerDes
outmemsys.io.incoherent := htif.io.cpu.map(_.reset) outmemsys.io.incoherent := htif.io.cpu.map(_.reset)
outmemsys.io.htif_uncached <> htif.io.mem outmemsys.io.htif_uncached <> htif.io.mem
@ -149,28 +156,27 @@ class Uncore extends Module with TopLevelParameters {
io.htif(i).id := htif.io.cpu(i).id io.htif(i).id := htif.io.cpu(i).id
htif.io.cpu(i).ipi_req <> io.htif(i).ipi_req htif.io.cpu(i).ipi_req <> io.htif(i).ipi_req
io.htif(i).ipi_rep <> htif.io.cpu(i).ipi_rep io.htif(i).ipi_rep <> htif.io.cpu(i).ipi_rep
htif.io.cpu(i).debug_stats_pcr <> io.htif(i).debug_stats_pcr htif.io.cpu(i).debug_stats_csr <> io.htif(i).debug_stats_csr
val pcr_arb = Module(new SMIArbiter(2, 64, 12)) val csr_arb = Module(new SMIArbiter(2, xLen, csrAddrBits))
pcr_arb.io.in(0) <> htif.io.cpu(i).pcr csr_arb.io.in(0) <> htif.io.cpu(i).csr
pcr_arb.io.in(1) <> outmemsys.io.pcr(i) csr_arb.io.in(1) <> outmemsys.io.csr(i)
io.htif(i).pcr <> pcr_arb.io.out io.htif(i).csr <> csr_arb.io.out
} }
// Arbitrate SCR access between MMIO and HTIF // Arbitrate SCR access between MMIO and HTIF
val scrArb = Module(new SMIArbiter(2, 64, scrAddrBits))
val scrFile = Module(new SCRFile) val scrFile = Module(new SCRFile)
val scrArb = Module(new SMIArbiter(2, scrDataBits, scrAddrBits))
scrArb.io.in(0) <> htif.io.scr scrArb.io.in(0) <> htif.io.scr
scrArb.io.in(1) <> outmemsys.io.scr scrArb.io.in(1) <> outmemsys.io.scr
scrFile.io.smi <> scrArb.io.out scrFile.io.smi <> scrArb.io.out
// scrFile.io.scr <> (... your SCR connections ...) // scrFile.io.scr <> (... your SCR connections ...)
// Wire the htif to the memory port(s) and host interface // Wire the htif to the memory port(s) and host interface
io.host.debug_stats_pcr := htif.io.host.debug_stats_pcr io.host.debug_stats_csr := htif.io.host.debug_stats_csr
io.mem <> outmemsys.io.mem io.mem <> outmemsys.io.mem
io.mmio <> outmemsys.io.mmio io.mmio <> outmemsys.io.mmio
if(params(UseBackupMemoryPort)) { if(p(UseBackupMemoryPort)) {
outmemsys.io.mem_backup_en := io.mem_backup_ctrl.en outmemsys.io.mem_backup_en := io.mem_backup_ctrl.en
VLSIUtils.padOutHTIFWithDividedClock(htif.io.host, scrFile.io.scr, VLSIUtils.padOutHTIFWithDividedClock(htif.io.host, scrFile.io.scr,
outmemsys.io.mem_backup, io.mem_backup_ctrl, io.host, htifW) outmemsys.io.mem_backup, io.mem_backup_ctrl, io.host, htifW)
@ -183,18 +189,18 @@ class Uncore extends Module with TopLevelParameters {
/** The whole outer memory hierarchy, including a NoC, some kind of coherence /** The whole outer memory hierarchy, including a NoC, some kind of coherence
* manager agent, and a converter from TileLink to MemIO. * manager agent, and a converter from TileLink to MemIO.
*/ */
class OuterMemorySystem extends Module with TopLevelParameters { class OuterMemorySystem(implicit val p: Parameters) extends Module with HasTopLevelParameters {
val io = new Bundle { val io = new Bundle {
val tiles_cached = Vec(new ClientTileLinkIO, nTiles).flip val tiles_cached = Vec(new ClientTileLinkIO, nTiles).flip
val tiles_uncached = Vec(new ClientUncachedTileLinkIO, nTiles).flip val tiles_uncached = Vec(new ClientUncachedTileLinkIO, nTiles).flip
val htif_uncached = (new ClientUncachedTileLinkIO).flip val htif_uncached = (new ClientUncachedTileLinkIO).flip
val incoherent = Vec(Bool(), nTiles).asInput val incoherent = Vec(Bool(), nTiles).asInput
val mem = Vec(new NASTIIO, nMemChannels) val mem = Vec(new NastiIO, nMemChannels)
val mem_backup = new MemSerializedIO(htifW) val mem_backup = new MemSerializedIO(htifW)
val mem_backup_en = Bool(INPUT) val mem_backup_en = Bool(INPUT)
val pcr = Vec(new SMIIO(xLen, pcrAddrBits), nTiles) val csr = Vec(new SMIIO(xLen, csrAddrBits), nTiles)
val scr = new SMIIO(xLen, scrAddrBits) val scr = new SMIIO(xLen, scrAddrBits)
val mmio = new NASTIIO val mmio = new NastiIO
} }
// Create a simple L1toL2 NoC between the tiles+htif and the banks of outer memory // Create a simple L1toL2 NoC between the tiles+htif and the banks of outer memory
@ -211,7 +217,7 @@ class OuterMemorySystem extends Module with TopLevelParameters {
// Create point(s) of coherence serialization // Create point(s) of coherence serialization
val nManagers = nMemChannels * nBanksPerMemChannel val nManagers = nMemChannels * nBanksPerMemChannel
val managerEndpoints = List.fill(nManagers) { params(BuildL2CoherenceManager)()} val managerEndpoints = List.fill(nManagers) { p(BuildL2CoherenceManager)(p)}
managerEndpoints.foreach { _.incoherent := io.incoherent } managerEndpoints.foreach { _.incoherent := io.incoherent }
// Wire the tiles and htif to the TileLink client ports of the L1toL2 network, // Wire the tiles and htif to the TileLink client ports of the L1toL2 network,
@ -220,27 +226,26 @@ class OuterMemorySystem extends Module with TopLevelParameters {
l1tol2net.io.managers <> managerEndpoints.map(_.innerTL) l1tol2net.io.managers <> managerEndpoints.map(_.innerTL)
// Create a converter between TileLinkIO and MemIO for each channel // Create a converter between TileLinkIO and MemIO for each channel
val outerTLParams = params.alterPartial({ case TLId => "L2ToMC" }) val outerTLParams = p.alterPartial({ case TLId => "L2toMC" })
val backendBuffering = TileLinkDepths(0,0,0,0,0) val backendBuffering = TileLinkDepths(0,0,0,0,0)
val addrMap = params(NASTIAddrHashMap) val addrMap = p(GlobalAddrMap)
val addrHashMap = new AddrHashMap(addrMap)
val nMasters = managerEndpoints.size + 1
val nSlaves = addrHashMap.nEntries
println("Generated Address Map") println("Generated Address Map")
for ((name, base, size, _) <- addrMap.sortedEntries) { for ((name, base, size, _) <- addrHashMap.sortedEntries) {
println(f"\t$name%s $base%x - ${base + size - 1}%x") println(f"\t$name%s $base%x - ${base + size - 1}%x")
} }
val interconnect = Module(new NASTITopInterconnect) val interconnect = Module(new NastiTopInterconnect(nMasters, nSlaves, addrMap)(p))
for ((bank, i) <- managerEndpoints.zipWithIndex) { for ((bank, i) <- managerEndpoints.zipWithIndex) {
val factor = params(TLDataBits) / params(MIFDataBits) val outermostTLParams = p.alterPartial({case TLId => "Outermost"})
val outermostTLParams = outerTLParams.alterPartial({ val unwrap = Module(new ClientTileLinkIOUnwrapper()(outerTLParams))
case TLDataBeats => params(MIFDataBeats) val narrow = Module(new TileLinkIONarrower("L2toMC", "Outermost"))
case TLDataBits => params(MIFDataBits) val conv = Module(new NastiIOTileLinkIOConverter()(outermostTLParams))
})
val unwrap = Module(new ClientTileLinkIOUnwrapper)(outerTLParams)
val narrow = Module(new TileLinkIONarrower(factor))(outerTLParams)
val conv = Module(new NASTIIOTileLinkIOConverter)(outermostTLParams)
unwrap.io.in <> bank.outerTL unwrap.io.in <> bank.outerTL
narrow.io.in <> unwrap.io.out narrow.io.in <> unwrap.io.out
conv.io.tl <> narrow.io.out conv.io.tl <> narrow.io.out
@ -252,24 +257,24 @@ class OuterMemorySystem extends Module with TopLevelParameters {
for (i <- 0 until nTiles) { for (i <- 0 until nTiles) {
val csrName = s"conf:csr$i" val csrName = s"conf:csr$i"
val csrPort = addrMap(csrName).port val csrPort = addrHashMap(csrName).port
val conv = Module(new SMIIONASTIIOConverter(xLen, pcrAddrBits)) val conv = Module(new SMIIONastiIOConverter(xLen, csrAddrBits))
conv.io.nasti <> interconnect.io.slaves(csrPort) conv.io.nasti <> interconnect.io.slaves(csrPort)
io.pcr(i) <> conv.io.smi io.csr(i) <> conv.io.smi
} }
val conv = Module(new SMIIONASTIIOConverter(xLen, scrAddrBits)) val conv = Module(new SMIIONastiIOConverter(scrDataBits, scrAddrBits))
conv.io.nasti <> interconnect.io.slaves(addrMap("conf:scr").port) conv.io.nasti <> interconnect.io.slaves(addrHashMap("conf:scr").port)
io.scr <> conv.io.smi io.scr <> conv.io.smi
io.mmio <> interconnect.io.slaves(addrMap("io").port) io.mmio <> interconnect.io.slaves(addrHashMap("io").port)
val mem_channels = interconnect.io.slaves.take(nMemChannels) val mem_channels = interconnect.io.slaves.take(nMemChannels)
// Create a SerDes for backup memory port // Create a SerDes for backup memory port
if(params(UseBackupMemoryPort)) { if(p(UseBackupMemoryPort)) {
VLSIUtils.doOuterMemorySystemSerdes( VLSIUtils.doOuterMemorySystemSerdes(
mem_channels, io.mem, io.mem_backup, io.mem_backup_en, mem_channels, io.mem, io.mem_backup, io.mem_backup_en,
nMemChannels, params(HTIFWidth), params(CacheBlockOffsetBits)) nMemChannels, htifW, p(CacheBlockOffsetBits))
} else { io.mem <> mem_channels } } else { io.mem <> mem_channels }
} }

View File

@ -7,24 +7,26 @@ import junctions._
import uncore._ import uncore._
class MemDessert extends Module { class MemDessert extends Module {
val io = new MemDesserIO(params(HTIFWidth)) implicit val p = params
val x = Module(new MemDesser(params(HTIFWidth))) val io = new MemDesserIO(p(HtifKey).width)
val x = Module(new MemDesser(p(HtifKey).width))
io.narrow <> x.io.narrow io.narrow <> x.io.narrow
io.wide <> x.io.wide io.wide <> x.io.wide
} }
object VLSIUtils { object VLSIUtils {
def doOuterMemorySystemSerdes( def doOuterMemorySystemSerdes(
llcs: Seq[NASTIIO], llcs: Seq[NastiIO],
mems: Seq[NASTIIO], mems: Seq[NastiIO],
backup: MemSerializedIO, backup: MemSerializedIO,
en: Bool, en: Bool,
nMemChannels: Int, nMemChannels: Int,
htifWidth: Int, htifWidth: Int,
blockOffsetBits: Int) { blockOffsetBits: Int)
(implicit p: Parameters) {
val arb = Module(new NASTIArbiter(nMemChannels)) val arb = Module(new NastiArbiter(nMemChannels))
val conv = Module(new MemIONASTIIOConverter(blockOffsetBits)) val conv = Module(new MemIONastiIOConverter(blockOffsetBits))
val mem_serdes = Module(new MemSerdes(htifWidth)) val mem_serdes = Module(new MemSerdes(htifWidth))
conv.io.nasti <> arb.io.slave conv.io.nasti <> arb.io.slave

View File

@ -9,22 +9,22 @@ import rocket._
import zscale._ import zscale._
case object UseZscale extends Field[Boolean] case object UseZscale extends Field[Boolean]
case object BuildZscale extends Field[(Bool) => Zscale] case object BuildZscale extends Field[(Bool, Parameters) => Zscale]
case object BootROMCapacity extends Field[Int] case object BootROMCapacity extends Field[Int]
case object DRAMCapacity extends Field[Int] case object DRAMCapacity extends Field[Int]
class ZscaleSystem extends Module { class ZscaleSystem(implicit p: Parameters) extends Module {
val io = new Bundle { val io = new Bundle {
val host = new HTIFIO val host = new HtifIO
val jtag = new HASTIMasterIO().flip val jtag = new HastiMasterIO().flip
val bootmem = new HASTISlaveIO().flip val bootmem = new HastiSlaveIO().flip
val dram = new HASTISlaveIO().flip val dram = new HastiSlaveIO().flip
val spi = new HASTISlaveIO().flip val spi = new HastiSlaveIO().flip
val led = new POCIIO val led = new PociIO
val corereset = new POCIIO val corereset = new PociIO
} }
val core = params(BuildZscale)(io.host.reset) val core = p(BuildZscale)(io.host.reset, p)
val bootmem_afn = (addr: UInt) => addr(31, 14) === UInt(0) val bootmem_afn = (addr: UInt) => addr(31, 14) === UInt(0)
@ -36,11 +36,11 @@ class ZscaleSystem extends Module {
val led_afn = (addr: UInt) => addr(31) === UInt(1) && addr(30, 10) === UInt(0) val led_afn = (addr: UInt) => addr(31) === UInt(1) && addr(30, 10) === UInt(0)
val corereset_afn = (addr: UInt) => addr(31) === UInt(1) && addr(30, 10) === UInt(1) val corereset_afn = (addr: UInt) => addr(31) === UInt(1) && addr(30, 10) === UInt(1)
val xbar = Module(new HASTIXbar(3, Seq(bootmem_afn, sbus_afn))) val xbar = Module(new HastiXbar(3, Seq(bootmem_afn, sbus_afn)))
val sadapter = Module(new HASTISlaveToMaster) val sadapter = Module(new HastiSlaveToMaster)
val sbus = Module(new HASTIBus(Seq(dram_afn, spi_afn, pbus_afn))) val sbus = Module(new HastiBus(Seq(dram_afn, spi_afn, pbus_afn)))
val padapter = Module(new HASTItoPOCIBridge) val padapter = Module(new HastiToPociBridge)
val pbus = Module(new POCIBus(Seq(led_afn, corereset_afn))) val pbus = Module(new PociBus(Seq(led_afn, corereset_afn)))
core.io.host <> io.host core.io.host <> io.host
xbar.io.masters(0) <> io.jtag xbar.io.masters(0) <> io.jtag
@ -60,14 +60,14 @@ class ZscaleSystem extends Module {
io.corereset <> pbus.io.slaves(1) io.corereset <> pbus.io.slaves(1)
} }
class ZscaleTop extends Module { class ZscaleTop(implicit p: Parameters) extends Module {
val io = new Bundle { val io = new Bundle {
val host = new HTIFIO val host = new HtifIO
} }
val sys = Module(new ZscaleSystem) val sys = Module(new ZscaleSystem)
val bootmem = Module(new HASTISRAM(params(BootROMCapacity)/4)) val bootmem = Module(new HastiSRAM(p(BootROMCapacity)/4))
val dram = Module(new HASTISRAM(params(DRAMCapacity)/4)) val dram = Module(new HastiSRAM(p(DRAMCapacity)/4))
sys.io.host <> io.host sys.io.host <> io.host
bootmem.io <> sys.io.bootmem bootmem.io <> sys.io.bootmem

2
uncore

@ -1 +1 @@
Subproject commit 52e1e91c281a03cd7b2399a0a811ad124749c1c8 Subproject commit b0eece1f613d4aafa3f9cf5470576ffb5110e856

2
zscale

@ -1 +1 @@
Subproject commit 461e7ee16bb15144e14c42855bf2ee23abd51806 Subproject commit 3338af40491ccfe4b403761d755372c201003e39