1
0
rocket-chip/src/main/scala/TestConfigs.scala

256 lines
9.0 KiB
Scala
Raw Normal View History

package rocketchip
import Chisel._
import groundtest._
import rocket._
import uncore.tilelink._
import uncore.coherence._
import uncore.agents._
import uncore.devices.NTiles
2016-01-07 06:38:35 +01:00
import junctions._
import scala.collection.mutable.LinkedHashSet
import cde.{Parameters, Config, Dump, Knob, CDEMatchError}
import scala.math.max
import ConfigUtils._
class WithGroundTest extends Config(
(pname, site, here) => pname match {
case TLKey("L1toL2") =>
TileLinkParameters(
coherencePolicy = new MESICoherence(site(L2DirectoryRepresentation)),
nManagers = site(NBanksPerMemoryChannel)*site(NMemoryChannels) + 1,
nCachingClients = site(NCachedTileLinkPorts),
nCachelessClients = site(NUncachedTileLinkPorts),
2016-07-08 20:40:16 +02:00
maxClientXacts = ((site(NMSHRs) + 1) +:
site(GroundTestKey).map(_.maxXacts))
.reduce(max(_, _)),
maxClientsPerPort = 1,
maxManagerXacts = site(NAcquireTransactors) + 2,
dataBeats = 8,
dataBits = site(CacheBlockBytes)*8)
case BuildTiles => {
val groundtest = if (site(XLen) == 64)
DefaultTestSuites.groundtest64
else
DefaultTestSuites.groundtest32
TestGeneration.addSuite(groundtest("p"))
TestGeneration.addSuite(DefaultTestSuites.emptyBmarks)
(0 until site(NTiles)).map { i =>
2016-07-08 20:40:16 +02:00
val tileSettings = site(GroundTestKey)(i)
(r: Bool, p: Parameters) => {
Module(new GroundTestTile(r)(p.alterPartial({
case TLId => "L1toL2"
2016-07-08 20:40:16 +02:00
case GroundTestId => i
case NCachedTileLinkPorts => if(tileSettings.cached > 0) 1 else 0
case NUncachedTileLinkPorts => tileSettings.uncached
case RoccNCSRs => tileSettings.csrs
})))
2016-07-08 20:40:16 +02:00
}
}
}
case UseFPU => false
case UseAtomics => false
case _ => throw new CDEMatchError
})
2016-06-06 19:48:25 +02:00
class WithComparator extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(uncached = site(ComparatorKey).targets.size)
}
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new ComparatorCore()(p))
2016-06-06 19:48:25 +02:00
case ComparatorKey => ComparatorParameters(
targets = Seq(0L, 0x100L).map(site(GlobalAddrMap)("mem").start.longValue + _),
2016-06-06 19:48:25 +02:00
width = 8,
operations = 1000,
atomics = site(UseAtomics),
prefetches = site("COMPARATOR_PREFETCHES"))
case UseFPU => false
case UseAtomics => false
case "COMPARATOR_PREFETCHES" => false
2016-06-06 19:48:25 +02:00
case _ => throw new CDEMatchError
})
class WithAtomics extends Config(
(pname, site, here) => pname match {
case UseAtomics => true
2016-07-08 20:40:16 +02:00
case _ => throw new CDEMatchError
})
class WithPrefetches extends Config(
(pname, site, here) => pname match {
case "COMPARATOR_PREFETCHES" => true
2016-07-08 20:40:16 +02:00
case _ => throw new CDEMatchError
})
class WithMemtest extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(1, 1)
}
case GeneratorKey => GeneratorParameters(
maxRequests = 128,
startAddress = site(GlobalAddrMap)("mem").start)
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new GeneratorTest()(p))
case _ => throw new CDEMatchError
})
2016-07-08 20:40:16 +02:00
class WithNGenerators(nUncached: Int, nCached: Int) extends Config(
2016-07-06 02:42:57 +02:00
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(nUncached, nCached)
}
2016-07-06 02:42:57 +02:00
case _ => throw new CDEMatchError
})
class WithCacheFillTest extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(uncached = 1)
}
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new CacheFillTest()(p))
case _ => throw new CDEMatchError
},
knobValues = {
case "L2_WAYS" => 4
case "L2_CAPACITY_IN_KB" => 4
case _ => throw new CDEMatchError
})
class WithBroadcastRegressionTest extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(1, 1, maxXacts = 3)
}
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(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 {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(1, 1, maxXacts = 5)
}
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new RegressionTest()(p))
case GroundTestRegressions =>
(p: Parameters) => RegressionTests.cacheRegressions(p)
case _ => throw new CDEMatchError
2016-01-07 06:38:35 +01:00
})
2016-02-10 20:12:39 +01:00
class WithNastiConverterTest extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(uncached = 1)
}
case GeneratorKey => GeneratorParameters(
maxRequests = 128,
startAddress = site(GlobalAddrMap)("mem").start)
2016-02-10 20:12:39 +01:00
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new NastiConverterTest()(p))
case _ => throw new CDEMatchError
2016-02-10 20:12:39 +01:00
})
class WithUnitTest extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) { GroundTestTileSettings() }
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new UnitTestSuite()(p))
case _ => throw new CDEMatchError
})
class WithTraceGen extends Config(
(pname, site, here) => pname match {
2016-07-08 20:40:16 +02:00
case GroundTestKey => Seq.fill(site(NTiles)) {
GroundTestTileSettings(cached = 1)
}
case BuildGroundTest =>
2016-07-08 20:40:16 +02:00
(p: Parameters) => Module(new GroundTestTraceGenerator()(p))
case GeneratorKey => GeneratorParameters(
maxRequests = 128,
startAddress = 0)
case AddressBag => List(0x8, 0x10, 0x108, 0x100008)
case _ => throw new CDEMatchError
})
2016-07-06 02:42:57 +02:00
class GroundTestConfig extends Config(new WithGroundTest ++ new BaseConfig)
class ComparatorConfig extends Config(new WithComparator ++ new GroundTestConfig)
class ComparatorL2Config extends Config(
new WithAtomics ++ new WithPrefetches ++
new WithL2Cache ++ new ComparatorConfig)
2016-07-05 02:07:58 +02:00
class ComparatorBufferlessConfig extends Config(
new WithBufferlessBroadcastHub ++ new ComparatorConfig)
2016-07-06 02:42:57 +02:00
class MemtestConfig extends Config(new WithMemtest ++ new GroundTestConfig)
class MemtestL2Config extends Config(
new WithMemtest ++ new WithL2Cache ++ new GroundTestConfig)
2016-07-05 02:07:58 +02:00
class MemtestBufferlessConfig extends Config(
new WithMemtest ++ new WithBufferlessBroadcastHub ++ new GroundTestConfig)
2016-07-06 02:42:57 +02:00
// Test ALL the things
class FancyMemtestConfig extends Config(
2016-07-08 20:40:16 +02:00
new WithNGenerators(1, 2) ++ new WithNCores(2) ++ new WithMemtest ++
2016-07-06 02:42:57 +02:00
new WithNMemoryChannels(2) ++ new WithNBanksPerMemChannel(4) ++
new WithSplitL2Metadata ++ new WithL2Cache ++ new GroundTestConfig)
class CacheFillTestConfig extends Config(
2016-05-03 22:39:04 +02:00
new WithCacheFillTest ++ new WithPLRU ++ new WithL2Cache ++ new GroundTestConfig)
2016-07-06 02:42:57 +02:00
class BroadcastRegressionTestConfig extends Config(
new WithBroadcastRegressionTest ++ new GroundTestConfig)
2016-07-05 02:07:58 +02:00
class BufferlessRegressionTestConfig extends Config(
new WithBufferlessBroadcastHub ++ new BroadcastRegressionTestConfig)
class CacheRegressionTestConfig extends Config(
new WithCacheRegressionTest ++ new WithL2Cache ++ new GroundTestConfig)
2016-07-06 02:42:57 +02:00
2016-02-10 20:12:39 +01:00
class NastiConverterTestConfig extends Config(new WithNastiConverterTest ++ new GroundTestConfig)
class FancyNastiConverterTestConfig extends Config(
new WithNCores(2) ++ new WithNastiConverterTest ++
new WithNMemoryChannels(2) ++ new WithNBanksPerMemChannel(4) ++
new WithL2Cache ++ new GroundTestConfig)
2016-07-06 02:42:57 +02:00
class UnitTestConfig extends Config(new WithUnitTest ++ new GroundTestConfig)
2016-07-06 02:42:57 +02:00
class TraceGenConfig extends Config(
new WithNCores(2) ++ new WithTraceGen ++ new GroundTestConfig)
class TraceGenBufferlessConfig extends Config(
new WithBufferlessBroadcastHub ++ new TraceGenConfig)
class TraceGenL2Config extends Config(
new WithL2Cache ++ new TraceGenConfig)
class MIF128BitComparatorConfig extends Config(
new WithMIFDataBits(128) ++ new ComparatorConfig)
class MIF128BitMemtestConfig extends Config(
new WithMIFDataBits(128) ++ new MemtestConfig)
class MIF32BitComparatorConfig extends Config(
new WithMIFDataBits(32) ++ new ComparatorConfig)
class MIF32BitMemtestConfig extends Config(
new WithMIFDataBits(32) ++ new MemtestConfig)
class WithPCIeMockupTest extends Config(
(pname, site, here) => pname match {
case NTiles => 2
case GroundTestKey => Seq(
GroundTestTileSettings(1, 1),
GroundTestTileSettings(1))
case GeneratorKey => GeneratorParameters(
maxRequests = 128,
startAddress = site(GlobalAddrMap)("mem").start)
case BuildGroundTest =>
(p: Parameters) => {
val id = p(GroundTestId)
if (id == 0) Module(new GeneratorTest()(p))
else Module(new NastiConverterTest()(p))
}
case _ => throw new CDEMatchError
})
class PCIeMockupTestConfig extends Config(
new WithPCIeMockupTest ++ new GroundTestConfig)