Configs: use a uniform syntax without Match exceptions (#507)
* Configs: use a uniform syntax without Match exceptions The old style of specifying Configs used total functions. The only way to indicate that a key was not matched was to throw an exception. Not only was this a performance concern, but it also caused confusing error messages whenever you had a match failure from a lookup within a lookup. The exception could get handled by an outer-lookup that then reported the wrong key as missing.
This commit is contained in:
parent
b448387899
commit
52bb6cd9d9
@ -3,9 +3,6 @@
|
||||
package config
|
||||
|
||||
class Field[T]
|
||||
class CDEMatchError() extends Exception {
|
||||
override def fillInStackTrace() = this
|
||||
}
|
||||
|
||||
abstract class View {
|
||||
final def apply[T](pname: Field[T]): T = apply(pname, this)
|
||||
@ -16,10 +13,8 @@ abstract class View {
|
||||
|
||||
abstract class Parameters extends View {
|
||||
final def ++ (x: Parameters): Parameters = new ChainParameters(this, x)
|
||||
final def alter(f: (Any, View, View, View) => Any): Parameters = Parameters(f) ++ this
|
||||
final def alter(m: Map[Any,Any]): Parameters = Parameters(m) ++ this
|
||||
final def alter(f: PartialFunction[Any,Any]): Parameters = Parameters(f) ++ this
|
||||
final def alterPartial(f: PartialFunction[Any,Any]): Parameters = Parameters(f) ++ this
|
||||
final def alter(f: (View, View, View) => PartialFunction[Any,Any]): Parameters = Parameters(f) ++ this
|
||||
final def alterPartial(f: PartialFunction[Any,Any]): Parameters = Parameters((_,_,_) => f) ++ this
|
||||
|
||||
protected[config] def chain(site: View, tail: View, pname: Any): Any
|
||||
protected[config] def find(pname: Any, site: View) = chain(site, new TerminalView, pname)
|
||||
@ -27,26 +22,18 @@ abstract class Parameters extends View {
|
||||
|
||||
object Parameters {
|
||||
def empty: Parameters = new EmptyParameters
|
||||
def apply(f: (Any, View, View, View) => Any): Parameters = new FunctionParameters(f)
|
||||
def apply(m: Map[Any,Any]): Parameters = new MapParameters(m)
|
||||
def apply(f: PartialFunction[Any,Any]): Parameters = new PartialParameters(f)
|
||||
def partial(f: PartialFunction[Any,Any]): Parameters = new PartialParameters(f)
|
||||
def apply(f: (View, View, View) => PartialFunction[Any,Any]): Parameters = new PartialParameters(f)
|
||||
def root(p: Parameters) = p
|
||||
}
|
||||
|
||||
class Config(p: Parameters) extends Parameters {
|
||||
def this(f: (Any, View, View) => Any) = this(Parameters((p,s,h,u) => f(p,s,h))) // backwards compat; don't use
|
||||
def this(f: (Any, View, View, View) => Any) = this(Parameters(f))
|
||||
def this(m: Map[Any,Any]) = this(Parameters(m))
|
||||
def this(f: PartialFunction[Any,Any]) = this(Parameters(f))
|
||||
def this(f: (View, View, View) => PartialFunction[Any,Any]) = this(Parameters(f))
|
||||
|
||||
protected[config] def chain(site: View, tail: View, pname: Any) = p.chain(site, tail, pname)
|
||||
override def toString = this.getClass.getSimpleName
|
||||
def toInstance = this
|
||||
}
|
||||
|
||||
class ConfigPartial(f: PartialFunction[Any,Any]) extends Config(Parameters(f))
|
||||
|
||||
// Internal implementation:
|
||||
|
||||
private class TerminalView extends View {
|
||||
@ -66,22 +53,9 @@ private class EmptyParameters extends Parameters {
|
||||
def chain(site: View, tail: View, pname: Any) = tail.find(pname, site)
|
||||
}
|
||||
|
||||
private class FunctionParameters(f: (Any, View, View, View) => Any) extends Parameters {
|
||||
private class PartialParameters(f: (View, View, View) => PartialFunction[Any,Any]) extends Parameters {
|
||||
protected[config] def chain(site: View, tail: View, pname: Any) = {
|
||||
try f(pname, site, this, tail)
|
||||
catch {
|
||||
case e: CDEMatchError => tail.find(pname, site)
|
||||
case e: scala.MatchError => tail.find(pname, site)
|
||||
val g = f(site, this, tail)
|
||||
if (g.isDefinedAt(pname)) g.apply(pname) else tail.find(pname, site)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MapParameters(map: Map[Any, Any]) extends Parameters {
|
||||
protected[config] def chain(site: View, tail: View, pname: Any) =
|
||||
map.get(pname).getOrElse(find(pname, site))
|
||||
}
|
||||
|
||||
private class PartialParameters(f: PartialFunction[Any,Any]) extends Parameters {
|
||||
protected[config] def chain(site: View, tail: View, pname: Any) =
|
||||
if (f.isDefinedAt(pname)) f.apply(pname) else tail.find(pname, site)
|
||||
}
|
||||
|
@ -17,11 +17,7 @@ import uncore.converters._
|
||||
import uncore.util._
|
||||
import util._
|
||||
|
||||
class BaseCoreplexConfig extends Config (
|
||||
{ (pname,site,here) =>
|
||||
lazy val innerDataBits = site(XLen)
|
||||
lazy val innerDataBeats = (8 * site(CacheBlockBytes)) / innerDataBits
|
||||
pname match {
|
||||
class BaseCoreplexConfig extends Config ((site, here, up) => {
|
||||
//Memory Parameters
|
||||
case PAddrBits => 32
|
||||
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
||||
@ -101,7 +97,7 @@ class BaseCoreplexConfig extends Config (
|
||||
if (site(BuildRoCC).isEmpty) 1 else site(RoccMaxTaggedMemXacts)).max,
|
||||
maxClientsPerPort = if (site(BuildRoCC).isEmpty) 1 else 2,
|
||||
maxManagerXacts = site(NAcquireTransactors) + 2,
|
||||
dataBeats = innerDataBeats,
|
||||
dataBeats = (8 * site(CacheBlockBytes)) / site(XLen),
|
||||
dataBits = site(CacheBlockBytes)*8)
|
||||
}
|
||||
case BootROMFile => "./bootrom/bootrom.img"
|
||||
@ -111,71 +107,49 @@ class BaseCoreplexConfig extends Config (
|
||||
case CacheBlockBytes => 64
|
||||
case CacheBlockOffsetBits => log2Up(site(CacheBlockBytes))
|
||||
case EnableL2Logging => false
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
class WithNCores(n: Int) extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class WithNCores(n: Int) extends Config((site, here, up) => {
|
||||
case NTiles => n
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithNBanksPerMemChannel(n: Int) extends Config(
|
||||
(pname, site, here, up) => pname match {
|
||||
class WithNBanksPerMemChannel(n: Int) extends Config((site, here, up) => {
|
||||
case BankedL2Config => up(BankedL2Config, site).copy(nBanksPerChannel = n)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithNTrackersPerBank(n: Int) extends Config(
|
||||
(pname, site, here, up) => pname match {
|
||||
class WithNTrackersPerBank(n: Int) extends Config((site, here, up) => {
|
||||
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 {
|
||||
class WithL1ICacheSets(sets: Int) extends Config((site, here, up) => {
|
||||
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 {
|
||||
class WithL1DCacheSets(sets: Int) extends Config((site, here, up) => {
|
||||
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 {
|
||||
class WithL1ICacheWays(ways: Int) extends Config((site, here, up) => {
|
||||
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 {
|
||||
class WithL1DCacheWays(ways: Int) extends Config((site, here, up) => {
|
||||
case CacheName("L1D") => up(CacheName("L1D"), site).copy(nWays = ways)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithCacheBlockBytes(linesize: Int) extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class WithCacheBlockBytes(linesize: Int) extends Config((site, here, up) => {
|
||||
case CacheBlockBytes => linesize
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithDataScratchpad(n: Int) extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithDataScratchpad(n: Int) extends Config((site, here, up) => {
|
||||
case DataScratchpadSize => n
|
||||
case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = n / site(CacheBlockBytes))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
// TODO: re-add L2
|
||||
class WithL2Cache extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class WithL2Cache extends Config((site, here, up) => {
|
||||
case CacheName("L2") => CacheConfig(
|
||||
nSets = 1024,
|
||||
nWays = 1,
|
||||
@ -183,11 +157,9 @@ class WithL2Cache extends Config(
|
||||
nTLBEntries = 0,
|
||||
cacheIdBits = 1,
|
||||
splitMetadata = false)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithBufferlessBroadcastHub extends Config(
|
||||
(pname, site, here, up) => pname match {
|
||||
class WithBufferlessBroadcastHub extends Config((site, here, up) => {
|
||||
case BroadcastConfig => up(BroadcastConfig, site).copy(bufferless = true)
|
||||
})
|
||||
|
||||
@ -203,8 +175,7 @@ class WithBufferlessBroadcastHub extends Config(
|
||||
* system depends on coherence between channels in any way,
|
||||
* DO NOT use this configuration.
|
||||
*/
|
||||
class WithStatelessBridge extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithStatelessBridge extends Config((site, here, up) => {
|
||||
/* !!! FIXME
|
||||
case BankedL2Config => up(BankedL2Config, site).copy(coherenceManager = { case (_, _) =>
|
||||
val pass = LazyModule(new TLBuffer(0)(site))
|
||||
@ -212,39 +183,24 @@ class WithStatelessBridge extends Config(
|
||||
})
|
||||
*/
|
||||
case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithPLRU extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
class WithL2Capacity(size_kb: Int) extends Config(Parameters.empty)
|
||||
|
||||
class WithL2Capacity(size_kb: Int) extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithNL2Ways(n: Int) extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithNL2Ways(n: Int) extends Config((site, here, up) => {
|
||||
case CacheName("L2") => up(CacheName("L2"), site).copy(nWays = n)
|
||||
})
|
||||
|
||||
class WithRV32 extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class WithRV32 extends Config((site, here, up) => {
|
||||
case XLen => 32
|
||||
case FPUKey => Some(FPUConfig(divSqrt = false))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithBlockingL1 extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithBlockingL1 extends Config((site, here, up) => {
|
||||
case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithSmallCores extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithSmallCores extends Config((site, here, up) => {
|
||||
case MulDivKey => Some(MulDivConfig())
|
||||
case FPUKey => None
|
||||
case UseVM => false
|
||||
@ -253,11 +209,9 @@ class WithSmallCores extends Config(
|
||||
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
|
||||
})
|
||||
|
||||
class WithRoccExample extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithRoccExample extends Config((site, here, up) => {
|
||||
case BuildRoCC => Seq(
|
||||
RoccParameters(
|
||||
opcodes = OpcodeSet.custom0,
|
||||
@ -271,35 +225,24 @@ class WithRoccExample extends Config(
|
||||
generator = (p: Parameters) => Module(new CharacterCountExample()(p))))
|
||||
|
||||
case RoccMaxTaggedMemXacts => 1
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithDefaultBtb extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class WithDefaultBtb extends Config((site, here, up) => {
|
||||
case BtbKey => BtbParameters()
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithFastMulDiv extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class WithFastMulDiv extends Config((site, here, up) => {
|
||||
case MulDivKey => Some(MulDivConfig(mulUnroll = 8, mulEarlyOut = (site(XLen) > 32), divEarlyOut = true))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithoutMulDiv extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithoutMulDiv extends Config((site, here, up) => {
|
||||
case MulDivKey => None
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithoutFPU extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithoutFPU extends Config((site, here, up) => {
|
||||
case FPUKey => None
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithFPUWithoutDivSqrt extends Config (
|
||||
(pname, site, here) => pname match {
|
||||
class WithFPUWithoutDivSqrt extends Config((site, here, up) => {
|
||||
case FPUKey => Some(FPUConfig(divSqrt = false))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
@ -45,7 +45,7 @@ class FancyMemtestConfig extends Config(
|
||||
new WithL2Cache ++ new GroundTestConfig)
|
||||
|
||||
class CacheFillTestConfig extends Config(
|
||||
new WithNL2Ways(4) ++ new WithL2Capacity(4) ++ new WithCacheFillTest ++ new WithPLRU ++ new WithL2Cache ++ new GroundTestConfig)
|
||||
new WithNL2Ways(4) ++ new WithL2Capacity(4) ++ new WithCacheFillTest ++ new WithL2Cache ++ new GroundTestConfig)
|
||||
|
||||
class BroadcastRegressionTestConfig extends Config(
|
||||
new WithBroadcastRegressionTest ++ new GroundTestConfig)
|
||||
@ -73,8 +73,7 @@ class Edge32BitMemtestConfig extends Config(
|
||||
new WithEdgeDataBits(32) ++ new MemtestConfig)
|
||||
|
||||
/* Composable Configs to set individual parameters */
|
||||
class WithGroundTest extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithGroundTest extends Config((site, here, up) => {
|
||||
case TLKey("L1toL2") => {
|
||||
val useMEI = site(NTiles) <= 1
|
||||
val dataBeats = (8 * site(CacheBlockBytes)) / site(XLen)
|
||||
@ -96,11 +95,9 @@ class WithGroundTest extends Config(
|
||||
case FPUKey => None
|
||||
case UseAtomics => false
|
||||
case UseCompressed => false
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithComparator extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithComparator extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(uncached = 2)
|
||||
}
|
||||
@ -114,23 +111,17 @@ class WithComparator extends Config(
|
||||
prefetches = false)
|
||||
case FPUConfig => None
|
||||
case UseAtomics => false
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithAtomics extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithAtomics extends Config((site, here, up) => {
|
||||
case UseAtomics => true
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithPrefetches extends Config(
|
||||
(pname, site, here, up) => pname match {
|
||||
class WithPrefetches extends Config((site, here, up) => {
|
||||
case ComparatorKey => up(ComparatorKey, site).copy(prefetches = true)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithMemtest extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithMemtest extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(1, 1)
|
||||
}
|
||||
@ -139,29 +130,23 @@ class WithMemtest extends Config(
|
||||
startAddress = BigInt(site(ExtMem).base))
|
||||
case BuildGroundTest =>
|
||||
(p: Parameters) => Module(new GeneratorTest()(p))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithNGenerators(nUncached: Int, nCached: Int) extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithNGenerators(nUncached: Int, nCached: Int) extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(nUncached, nCached)
|
||||
}
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithCacheFillTest extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithCacheFillTest extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(uncached = 1)
|
||||
}
|
||||
case BuildGroundTest =>
|
||||
(p: Parameters) => Module(new CacheFillTest()(p))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithBroadcastRegressionTest extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithBroadcastRegressionTest extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(1, 1, maxXacts = 3)
|
||||
}
|
||||
@ -169,11 +154,9 @@ class WithBroadcastRegressionTest extends Config(
|
||||
(p: Parameters) => Module(new RegressionTest()(p))
|
||||
case GroundTestRegressions =>
|
||||
(p: Parameters) => RegressionTests.broadcastRegressions(p)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithCacheRegressionTest extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithCacheRegressionTest extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(1, 1, maxXacts = 5)
|
||||
}
|
||||
@ -181,11 +164,9 @@ class WithCacheRegressionTest extends Config(
|
||||
(p: Parameters) => Module(new RegressionTest()(p))
|
||||
case GroundTestRegressions =>
|
||||
(p: Parameters) => RegressionTests.cacheRegressions(p)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithTraceGen extends Config(
|
||||
(pname, site, here, up) => pname match {
|
||||
class WithTraceGen extends Config((site, here, up) => {
|
||||
case GroundTestKey => Seq.fill(site(NTiles)) {
|
||||
GroundTestTileSettings(uncached = 1, cached = 1)
|
||||
}
|
||||
@ -205,5 +186,4 @@ class WithTraceGen extends Config(
|
||||
}
|
||||
case UseAtomics => true
|
||||
case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = 16, nWays = 1)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
@ -19,8 +19,7 @@ import scala.collection.immutable.HashMap
|
||||
import DefaultTestSuites._
|
||||
import config._
|
||||
|
||||
class BasePlatformConfig extends Config(
|
||||
(pname,site,here) => pname match {
|
||||
class BasePlatformConfig extends Config((site, here, up) => {
|
||||
// TileLink connection parameters
|
||||
case TLMonitorBuilder => (args: TLMonitorArgs) => Some(LazyModule(new TLMonitor(args)))
|
||||
case TLFuzzReadyValid => false
|
||||
@ -36,7 +35,6 @@ class BasePlatformConfig extends Config(
|
||||
case ExtBus => MasterConfig(base=0x60000000L, size=0x20000000L, beatBytes=8, idBits=4)
|
||||
case ExtIn => SlaveConfig(beatBytes=8, idBits=8, sourceBits=2)
|
||||
case RTCPeriod => 100 // gives 10 MHz RTC assuming 1 GHz uncore clock
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class BaseConfig extends Config(new BaseCoreplexConfig ++ new BasePlatformConfig)
|
||||
@ -46,32 +44,21 @@ class DefaultL2Config extends Config(new WithL2Cache ++ new BaseConfig)
|
||||
class DefaultBufferlessConfig extends Config(
|
||||
new WithBufferlessBroadcastHub ++ new BaseConfig)
|
||||
|
||||
class FPGAConfig extends Config (
|
||||
(pname,site,here) => pname match {
|
||||
class FPGAConfig extends Config ((site, here, up) => {
|
||||
case NAcquireTransactors => 4
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
class DefaultFPGAConfig extends Config(new FPGAConfig ++ new BaseConfig)
|
||||
class DefaultL2FPGAConfig extends Config(
|
||||
new WithL2Capacity(64) ++ new WithL2Cache ++ new DefaultFPGAConfig)
|
||||
|
||||
class PLRUL2Config extends Config(new WithPLRU ++ new DefaultL2Config)
|
||||
|
||||
class WithNMemoryChannels(n: Int) extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithNMemoryChannels(n: Int) extends Config((site, here, up) => {
|
||||
case BankedL2Config => up(BankedL2Config, site).copy(nMemoryChannels = n)
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
class WithExtMemSize(n: Long) extends Config(
|
||||
(pname,site,here,up) => pname match {
|
||||
class WithExtMemSize(n: Long) extends Config((site, here, up) => {
|
||||
case ExtMem => up(ExtMem, site).copy(size = n)
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
class WithScratchpads extends Config(new WithNMemoryChannels(0) ++ new WithDataScratchpad(16384))
|
||||
|
||||
@ -97,10 +84,8 @@ class DualChannelDualBankL2Config extends Config(
|
||||
|
||||
class RoccExampleConfig extends Config(new WithRoccExample ++ new BaseConfig)
|
||||
|
||||
class WithEdgeDataBits(dataBits: Int) extends Config(
|
||||
(pname, site, here, up) => pname match {
|
||||
class WithEdgeDataBits(dataBits: Int) extends Config((site, here, up) => {
|
||||
case ExtMem => up(ExtMem, site).copy(beatBytes = dataBits/8)
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class Edge128BitConfig extends Config(
|
||||
@ -127,48 +112,30 @@ class TinyConfig extends Config(
|
||||
new WithSmallCores ++ new WithRV32 ++
|
||||
new WithStatelessBridge ++ new BaseConfig)
|
||||
|
||||
class WithJtagDTM extends Config (
|
||||
(pname, site, here) => pname match {
|
||||
class WithJtagDTM extends Config ((site, here, up) => {
|
||||
case IncludeJtagDTM => true
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
|
||||
class WithNoPeripheryArithAMO extends Config (
|
||||
(pname, site, here) => pname match {
|
||||
case PeripheryBusArithmetic => false
|
||||
}
|
||||
)
|
||||
|
||||
class With64BitPeriphery extends Config (
|
||||
(pname, site, here) => pname match {
|
||||
case PeripheryBusConfig => TLBusConfig(beatBytes = 8)
|
||||
}
|
||||
)
|
||||
|
||||
class WithoutTLMonitors extends Config (
|
||||
(pname, site, here) => pname match {
|
||||
case TLMonitorBuilder => (args: TLMonitorArgs) => None
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
|
||||
class WithNExtTopInterrupts(nExtInts: Int) extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
case NExtTopInterrupts => nExtInts
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
|
||||
class WithNBreakpoints(hwbp: Int) extends Config (
|
||||
(pname,site,here) => pname match {
|
||||
case NBreakpoints => hwbp
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
|
||||
class WithRTCPeriod(nCycles: Int) extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
case RTCPeriod => nCycles
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class WithNoPeripheryArithAMO extends Config ((site, here, up) => {
|
||||
case PeripheryBusArithmetic => false
|
||||
})
|
||||
|
||||
class With64BitPeriphery extends Config ((site, here, up) => {
|
||||
case PeripheryBusConfig => TLBusConfig(beatBytes = 8)
|
||||
})
|
||||
|
||||
class WithoutTLMonitors extends Config ((site, here, up) => {
|
||||
case TLMonitorBuilder => (args: TLMonitorArgs) => None
|
||||
})
|
||||
|
||||
class WithNExtTopInterrupts(nExtInts: Int) extends Config((site, here, up) => {
|
||||
case NExtTopInterrupts => nExtInts
|
||||
})
|
||||
|
||||
class WithNBreakpoints(hwbp: Int) extends Config ((site, here, up) => {
|
||||
case NBreakpoints => hwbp
|
||||
})
|
||||
|
||||
class WithRTCPeriod(nCycles: Int) extends Config((site, here, up) => {
|
||||
case RTCPeriod => nCycles
|
||||
})
|
||||
|
@ -7,8 +7,7 @@ import config._
|
||||
import junctions._
|
||||
import rocketchip.{BaseConfig, BasePlatformConfig}
|
||||
|
||||
class WithJunctionsUnitTests extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithJunctionsUnitTests extends Config((site, here, up) => {
|
||||
case HastiId => "HastiTest"
|
||||
case HastiKey("HastiTest") => HastiParameters(addrBits = 32, dataBits = 64)
|
||||
case NastiKey => NastiParameters(addrBits = 32, dataBits = 64, idBits = 4)
|
||||
@ -17,13 +16,11 @@ class WithJunctionsUnitTests extends Config(
|
||||
case UnitTests => (p: Parameters) => Seq(
|
||||
Module(new junctions.MultiWidthFifoTest),
|
||||
Module(new junctions.HastiTest()(p)))
|
||||
case _ => throw new CDEMatchError
|
||||
})
|
||||
|
||||
class JunctionsUnitTestConfig extends Config(new WithJunctionsUnitTests ++ new BasePlatformConfig)
|
||||
|
||||
class WithUncoreUnitTests extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithUncoreUnitTests extends Config((site, here, up) => {
|
||||
case uncore.tilelink.TLId => "L1toL2"
|
||||
case UnitTests => (q: Parameters) => {
|
||||
implicit val p = q
|
||||
@ -37,14 +34,11 @@ class WithUncoreUnitTests extends Config(
|
||||
Module(new uncore.axi4.AXI4LiteFuzzRAMTest),
|
||||
Module(new uncore.axi4.AXI4FullFuzzRAMTest),
|
||||
Module(new uncore.axi4.AXI4BridgeTest)) }
|
||||
case _ => throw new CDEMatchError
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
class UncoreUnitTestConfig extends Config(new WithUncoreUnitTests ++ new BaseConfig)
|
||||
|
||||
class WithTLSimpleUnitTests extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithTLSimpleUnitTests extends Config((site, here, up) => {
|
||||
case UnitTests => (q: Parameters) => {
|
||||
implicit val p = q
|
||||
Seq(
|
||||
@ -54,10 +48,9 @@ class WithTLSimpleUnitTests extends Config(
|
||||
Module(new uncore.tilelink2.TLRR0Test),
|
||||
Module(new uncore.tilelink2.TLRR1Test),
|
||||
Module(new uncore.tilelink2.TLRAMCrossingTest) ) }
|
||||
case _ => throw new CDEMatchError })
|
||||
})
|
||||
|
||||
class WithTLWidthUnitTests extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithTLWidthUnitTests extends Config((site, here, up) => {
|
||||
case UnitTests => (q: Parameters) => {
|
||||
implicit val p = q
|
||||
Seq(
|
||||
@ -67,10 +60,9 @@ class WithTLWidthUnitTests extends Config(
|
||||
Module(new uncore.tilelink2.TLRAMWidthWidgetTest( 1, 1)),
|
||||
Module(new uncore.tilelink2.TLRAMWidthWidgetTest( 4, 64)),
|
||||
Module(new uncore.tilelink2.TLRAMWidthWidgetTest(64, 4)) ) }
|
||||
case _ => throw new CDEMatchError })
|
||||
})
|
||||
|
||||
class WithTLXbarUnitTests extends Config(
|
||||
(pname, site, here) => pname match {
|
||||
class WithTLXbarUnitTests extends Config((site, here, up) => {
|
||||
case UnitTests => (q: Parameters) => {
|
||||
implicit val p = q
|
||||
Seq(
|
||||
@ -79,7 +71,7 @@ class WithTLXbarUnitTests extends Config(
|
||||
Module(new uncore.tilelink2.TLRAMXbarTest(8)),
|
||||
//Module(new uncore.tilelink2.TLMulticlientXbarTest(4,4)),
|
||||
Module(new uncore.tilelink2.TLMulticlientXbarTest(1,4)) ) }
|
||||
case _ => throw new CDEMatchError })
|
||||
})
|
||||
|
||||
class TLSimpleUnitTestConfig extends Config(new WithTLSimpleUnitTests ++ new BasePlatformConfig)
|
||||
class TLWidthUnitTestConfig extends Config(new WithTLWidthUnitTests ++ new BasePlatformConfig)
|
||||
|
Loading…
Reference in New Issue
Block a user