From 9f1c668c4fe349b91d308f440d8fc40e6d8f1ddc Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Wed, 23 Nov 2016 18:06:33 -0800 Subject: [PATCH] config: when modifying Parameters, subordinate lookups use top --- src/main/scala/coreplex/Configs.scala | 30 ++++++++++++------------- src/main/scala/groundtest/Configs.scala | 4 ++-- src/main/scala/rocketchip/Configs.scala | 6 ++--- src/main/scala/util/Config.scala | 3 ++- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/main/scala/coreplex/Configs.scala b/src/main/scala/coreplex/Configs.scala index 01a34c53..71cd5434 100644 --- a/src/main/scala/coreplex/Configs.scala +++ b/src/main/scala/coreplex/Configs.scala @@ -124,39 +124,39 @@ class WithNCores(n: Int) extends Config( class WithNBanksPerMemChannel(n: Int) extends Config( (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 }) class WithNTrackersPerBank(n: Int) extends Config( (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 }) // This is the number of sets **per way** class WithL1ICacheSets(sets: Int) extends Config( (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 }) // This is the number of sets **per way** class WithL1DCacheSets(sets: Int) extends Config( (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 }) class WithL1ICacheWays(ways: Int) extends Config( (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 }) class WithL1DCacheWays(ways: Int) extends Config( (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 }) @@ -169,7 +169,7 @@ class WithCacheBlockBytes(linesize: Int) extends Config( class WithDataScratchpad(n: Int) extends Config( (pname,site,here,up) => pname match { 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 }) @@ -188,7 +188,7 @@ class WithL2Cache extends Config( class WithBufferlessBroadcastHub extends Config( (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( (pname,site,here,up) => pname match { /* !!! FIXME - case BankedL2Config => up(BankedL2Config).copy(coherenceManager = { case (_, _) => + case BankedL2Config => up(BankedL2Config, site).copy(coherenceManager = { case (_, _) => val pass = LazyModule(new TLBuffer(0)) (pass.node, pass.node) }) */ - case DCacheKey => up(DCacheKey).copy(nMSHRs = 0) + case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0) case _ => throw new CDEMatchError }) @@ -227,7 +227,7 @@ class WithL2Capacity(size_kb: Int) extends Config( class WithNL2Ways(n: Int) extends Config( (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( @@ -239,7 +239,7 @@ class WithRV32 extends Config( class WithBlockingL1 extends Config( (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 }) @@ -250,9 +250,9 @@ class WithSmallCores extends Config( case UseVM => false case BtbKey => BtbParameters(nEntries = 0) case NAcquireTransactors => 2 - case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = 64, nWays = 1, nTLBEntries = 4) - case CacheName("L1I") => up(CacheName("L1I")).copy(nSets = 64, nWays = 1, nTLBEntries = 4) - case DCacheKey => up(DCacheKey).copy(nMSHRs = 0) + case CacheName("L1D") => up(CacheName("L1D"), site).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, site).copy(nMSHRs = 0) case _ => throw new CDEMatchError }) diff --git a/src/main/scala/groundtest/Configs.scala b/src/main/scala/groundtest/Configs.scala index 02dc603f..b1301079 100644 --- a/src/main/scala/groundtest/Configs.scala +++ b/src/main/scala/groundtest/Configs.scala @@ -123,7 +123,7 @@ class WithAtomics extends Config( class WithPrefetches extends Config( (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 }) @@ -202,6 +202,6 @@ class WithTraceGen extends Config( }.flatten } 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 }) diff --git a/src/main/scala/rocketchip/Configs.scala b/src/main/scala/rocketchip/Configs.scala index 8ab15a9d..b89e58e7 100644 --- a/src/main/scala/rocketchip/Configs.scala +++ b/src/main/scala/rocketchip/Configs.scala @@ -57,14 +57,14 @@ class PLRUL2Config extends Config(new WithPLRU ++ new DefaultL2Config) class WithNMemoryChannels(n: Int) extends Config( (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 } ) class WithExtMemSize(n: Long) extends Config( (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 } ) @@ -95,7 +95,7 @@ class RoccExampleConfig extends Config(new WithRoccExample ++ new BaseConfig) class WithEdgeDataBits(dataBits: Int) extends Config( (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 }) diff --git a/src/main/scala/util/Config.scala b/src/main/scala/util/Config.scala index 966b594b..fca8b747 100644 --- a/src/main/scala/util/Config.scala +++ b/src/main/scala/util/Config.scala @@ -6,7 +6,8 @@ class CDEMatchError() extends Exception { } 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 }