1
0

config: when modifying Parameters, subordinate lookups use top

This commit is contained in:
Wesley W. Terpstra 2016-11-23 18:06:33 -08:00
parent 566cc9e60b
commit 9f1c668c4f
4 changed files with 22 additions and 21 deletions

View File

@ -124,39 +124,39 @@ class WithNCores(n: Int) extends Config(
class WithNBanksPerMemChannel(n: Int) extends Config( class WithNBanksPerMemChannel(n: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case BankedL2Config => up(BankedL2Config).copy(nBanksPerChannel = n) case BankedL2Config => up(BankedL2Config, site).copy(nBanksPerChannel = n)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
class WithNTrackersPerBank(n: Int) extends Config( class WithNTrackersPerBank(n: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case BroadcastConfig => up(BroadcastConfig).copy(nTrackers = n) case BroadcastConfig => up(BroadcastConfig, site).copy(nTrackers = n)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
// This is the number of sets **per way** // This is the number of sets **per way**
class WithL1ICacheSets(sets: Int) extends Config( class WithL1ICacheSets(sets: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case CacheName("L1I") => up(CacheName("L1I")).copy(nSets = sets) case CacheName("L1I") => up(CacheName("L1I"), site).copy(nSets = sets)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
// This is the number of sets **per way** // This is the number of sets **per way**
class WithL1DCacheSets(sets: Int) extends Config( class WithL1DCacheSets(sets: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = sets) case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = sets)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
class WithL1ICacheWays(ways: Int) extends Config( class WithL1ICacheWays(ways: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case CacheName("L1I") => up(CacheName("L1I")).copy(nWays = ways) case CacheName("L1I") => up(CacheName("L1I"), site).copy(nWays = ways)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
class WithL1DCacheWays(ways: Int) extends Config( class WithL1DCacheWays(ways: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case CacheName("L1D") => up(CacheName("L1D")).copy(nWays = ways) case CacheName("L1D") => up(CacheName("L1D"), site).copy(nWays = ways)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
@ -169,7 +169,7 @@ class WithCacheBlockBytes(linesize: Int) extends Config(
class WithDataScratchpad(n: Int) extends Config( class WithDataScratchpad(n: Int) extends Config(
(pname,site,here,up) => pname match { (pname,site,here,up) => pname match {
case DataScratchpadSize => n case DataScratchpadSize => n
case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = n / site(CacheBlockBytes)) case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = n / site(CacheBlockBytes))
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
@ -188,7 +188,7 @@ class WithL2Cache extends Config(
class WithBufferlessBroadcastHub extends Config( class WithBufferlessBroadcastHub extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case BroadcastConfig => up(BroadcastConfig).copy(bufferless = true) case BroadcastConfig => up(BroadcastConfig, site).copy(bufferless = true)
}) })
/** /**
@ -206,12 +206,12 @@ class WithBufferlessBroadcastHub extends Config(
class WithStatelessBridge extends Config( class WithStatelessBridge extends Config(
(pname,site,here,up) => pname match { (pname,site,here,up) => pname match {
/* !!! FIXME /* !!! FIXME
case BankedL2Config => up(BankedL2Config).copy(coherenceManager = { case (_, _) => case BankedL2Config => up(BankedL2Config, site).copy(coherenceManager = { case (_, _) =>
val pass = LazyModule(new TLBuffer(0)) val pass = LazyModule(new TLBuffer(0))
(pass.node, pass.node) (pass.node, pass.node)
}) })
*/ */
case DCacheKey => up(DCacheKey).copy(nMSHRs = 0) case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
@ -227,7 +227,7 @@ class WithL2Capacity(size_kb: Int) extends Config(
class WithNL2Ways(n: Int) extends Config( class WithNL2Ways(n: Int) extends Config(
(pname,site,here,up) => pname match { (pname,site,here,up) => pname match {
case CacheName("L2") => up(CacheName("L2")).copy(nWays = n) case CacheName("L2") => up(CacheName("L2"), site).copy(nWays = n)
}) })
class WithRV32 extends Config( class WithRV32 extends Config(
@ -239,7 +239,7 @@ class WithRV32 extends Config(
class WithBlockingL1 extends Config( class WithBlockingL1 extends Config(
(pname,site,here,up) => pname match { (pname,site,here,up) => pname match {
case DCacheKey => up(DCacheKey).copy(nMSHRs = 0) case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
@ -250,9 +250,9 @@ class WithSmallCores extends Config(
case UseVM => false case UseVM => false
case BtbKey => BtbParameters(nEntries = 0) case BtbKey => BtbParameters(nEntries = 0)
case NAcquireTransactors => 2 case NAcquireTransactors => 2
case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = 64, nWays = 1, nTLBEntries = 4) case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = 64, nWays = 1, nTLBEntries = 4)
case CacheName("L1I") => up(CacheName("L1I")).copy(nSets = 64, nWays = 1, nTLBEntries = 4) case CacheName("L1I") => up(CacheName("L1I"), site).copy(nSets = 64, nWays = 1, nTLBEntries = 4)
case DCacheKey => up(DCacheKey).copy(nMSHRs = 0) case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })

View File

@ -123,7 +123,7 @@ class WithAtomics extends Config(
class WithPrefetches extends Config( class WithPrefetches extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case ComparatorKey => up(ComparatorKey).copy(prefetches = true) case ComparatorKey => up(ComparatorKey, site).copy(prefetches = true)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })
@ -202,6 +202,6 @@ class WithTraceGen extends Config(
}.flatten }.flatten
} }
case UseAtomics => true case UseAtomics => true
case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = 16, nWays = 1) case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = 16, nWays = 1)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })

View File

@ -57,14 +57,14 @@ class PLRUL2Config extends Config(new WithPLRU ++ new DefaultL2Config)
class WithNMemoryChannels(n: Int) extends Config( class WithNMemoryChannels(n: Int) extends Config(
(pname,site,here,up) => pname match { (pname,site,here,up) => pname match {
case BankedL2Config => up(BankedL2Config).copy(nMemoryChannels = n) case BankedL2Config => up(BankedL2Config, site).copy(nMemoryChannels = n)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
} }
) )
class WithExtMemSize(n: Long) extends Config( class WithExtMemSize(n: Long) extends Config(
(pname,site,here,up) => pname match { (pname,site,here,up) => pname match {
case ExtMem => up(ExtMem).copy(size = n) case ExtMem => up(ExtMem, site).copy(size = n)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
} }
) )
@ -95,7 +95,7 @@ class RoccExampleConfig extends Config(new WithRoccExample ++ new BaseConfig)
class WithEdgeDataBits(dataBits: Int) extends Config( class WithEdgeDataBits(dataBits: Int) extends Config(
(pname, site, here, up) => pname match { (pname, site, here, up) => pname match {
case ExtMem => up(ExtMem).copy(beatBytes = dataBits/8) case ExtMem => up(ExtMem, site).copy(beatBytes = dataBits/8)
case _ => throw new CDEMatchError case _ => throw new CDEMatchError
}) })

View File

@ -6,7 +6,8 @@ class CDEMatchError() extends Exception {
} }
abstract class View { abstract class View {
final def apply[T](pname: Field[T]): T = find(pname, this).asInstanceOf[T] final def apply[T](pname: Field[T]): T = apply(pname, this)
final def apply[T](pname: Field[T], site: View): T = find(pname, site).asInstanceOf[T]
protected[config] def find(pname: Any, site: View): Any protected[config] def find(pname: Any, site: View): Any
} }