2015-12-06 12:01:05 +01:00
|
|
|
package rocketchip
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import groundtest._
|
|
|
|
import rocket._
|
|
|
|
import uncore._
|
2016-01-07 06:38:35 +01:00
|
|
|
import junctions._
|
2016-02-22 18:07:26 +01:00
|
|
|
import scala.collection.mutable.LinkedHashSet
|
2016-04-22 04:37:08 +02:00
|
|
|
import cde.{Parameters, Config, Dump, Knob, CDEMatchError}
|
2015-12-06 12:01:05 +01:00
|
|
|
import scala.math.max
|
2016-03-16 22:21:47 +01:00
|
|
|
import ConfigUtils._
|
2015-12-06 12:01:05 +01:00
|
|
|
|
|
|
|
class WithGroundTest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case TLKey("L1toL2") =>
|
|
|
|
TileLinkParameters(
|
|
|
|
coherencePolicy = new MESICoherence(site(L2DirectoryRepresentation)),
|
2016-01-15 00:10:40 +01:00
|
|
|
nManagers = site(NBanksPerMemoryChannel)*site(NMemoryChannels) + 1,
|
2016-06-14 01:24:01 +02:00
|
|
|
nCachingClients = site(NCachedTileLinkPorts),
|
|
|
|
nCachelessClients = site(NUncachedTileLinkPorts),
|
2016-03-28 22:22:00 +02:00
|
|
|
maxClientXacts = max(
|
|
|
|
site(NMSHRs) + 1,
|
2016-06-09 04:59:35 +02:00
|
|
|
site(GroundTestMaxXacts)),
|
2016-06-14 01:24:01 +02:00
|
|
|
maxClientsPerPort = 1,
|
2015-12-06 12:01:05 +01:00
|
|
|
maxManagerXacts = site(NAcquireTransactors) + 2,
|
2016-05-26 03:01:57 +02:00
|
|
|
dataBeats = site(MIFDataBeats),
|
2015-12-06 12:01:05 +01:00
|
|
|
dataBits = site(CacheBlockBytes)*8)
|
|
|
|
case BuildTiles => {
|
2016-05-04 02:11:25 +02:00
|
|
|
val groundtest = if (site(XLen) == 64)
|
|
|
|
DefaultTestSuites.groundtest64
|
|
|
|
else
|
|
|
|
DefaultTestSuites.groundtest32
|
|
|
|
TestGeneration.addSuite(groundtest("p"))
|
2016-05-03 03:34:27 +02:00
|
|
|
TestGeneration.addSuite(DefaultTestSuites.emptyBmarks)
|
2015-12-06 12:01:05 +01:00
|
|
|
(0 until site(NTiles)).map { i =>
|
|
|
|
(r: Bool, p: Parameters) =>
|
2016-06-14 01:24:01 +02:00
|
|
|
Module(new GroundTestTile(i, r)(p.alterPartial({
|
|
|
|
case TLId => "L1toL2"
|
|
|
|
case NUncachedTileLinkPorts =>
|
|
|
|
(if (i == 0) 1 else 0) + p(GroundTestUncachedClients)
|
|
|
|
})))
|
2015-12-06 12:01:05 +01:00
|
|
|
}
|
|
|
|
}
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestCachedClients => 0
|
|
|
|
case GroundTestUncachedClients => 0
|
|
|
|
case GroundTestNPTW => 0
|
2015-12-06 12:01:05 +01:00
|
|
|
case GroundTestMaxXacts => 1
|
2016-03-25 03:52:12 +01:00
|
|
|
case GroundTestCSRs => Nil
|
2016-05-04 05:21:13 +02:00
|
|
|
case TohostAddr => BigInt("80001000", 16)
|
2016-03-25 03:52:12 +01:00
|
|
|
case RoccNCSRs => site(GroundTestCSRs).size
|
2016-02-22 18:07:26 +01:00
|
|
|
case UseFPU => false
|
2016-06-14 01:24:01 +02:00
|
|
|
case UseAtomics => false
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-12-06 12:01:05 +01:00
|
|
|
})
|
|
|
|
|
2016-06-06 19:48:25 +02:00
|
|
|
class WithComparator extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case TLKey("L1toL2") =>
|
|
|
|
TileLinkParameters(
|
|
|
|
coherencePolicy = new MESICoherence(site(L2DirectoryRepresentation)),
|
|
|
|
nManagers = site(NBanksPerMemoryChannel)*site(NMemoryChannels) + 1,
|
2016-06-14 01:24:01 +02:00
|
|
|
nCachingClients = site(NCachedTileLinkPorts),
|
|
|
|
nCachelessClients = site(NUncachedTileLinkPorts),
|
2016-06-06 19:48:25 +02:00
|
|
|
maxClientXacts = 2,
|
|
|
|
maxClientsPerPort = 1,
|
|
|
|
maxManagerXacts = site(NAcquireTransactors) + 2,
|
|
|
|
dataBeats = site(MIFDataBeats),
|
|
|
|
dataBits = site(CacheBlockBytes)*8)
|
2016-06-14 01:24:01 +02:00
|
|
|
case BuildTiles => {
|
|
|
|
val groundtest = if (site(XLen) == 64)
|
|
|
|
DefaultTestSuites.groundtest64
|
|
|
|
else
|
|
|
|
DefaultTestSuites.groundtest32
|
|
|
|
TestGeneration.addSuite(groundtest("p"))
|
|
|
|
TestGeneration.addSuite(DefaultTestSuites.emptyBmarks)
|
|
|
|
Seq((r: Bool, p: Parameters) => Module(new ComparatorTile(r)(
|
|
|
|
p.alterPartial({
|
|
|
|
case TLId => "L1toL2"
|
|
|
|
case NUncachedTileLinkPorts => 1 + site(ComparatorKey).targets.size
|
|
|
|
}))))
|
|
|
|
}
|
2016-06-06 19:48:25 +02:00
|
|
|
case ComparatorKey => ComparatorParameters(
|
2016-06-14 01:24:01 +02:00
|
|
|
targets = Seq(0L, 0x100L).map(site(GlobalAddrMap)("mem").start.longValue + _),
|
2016-06-06 19:48:25 +02:00
|
|
|
width = 8,
|
|
|
|
operations = 1000,
|
2016-06-14 01:24:01 +02:00
|
|
|
atomics = site(UseAtomics),
|
|
|
|
prefetches = site("COMPARATOR_PREFETCHES"))
|
|
|
|
case NUncachedTileLinkPorts => 1 + site(ComparatorKey).targets.size
|
2016-06-06 19:48:25 +02:00
|
|
|
case TohostAddr => BigInt("80001000", 16) // quit test by writing here
|
2016-06-14 01:24:01 +02:00
|
|
|
case UseFPU => false
|
|
|
|
case UseAtomics => false
|
|
|
|
case "COMPARATOR_PREFETCHES" => false
|
2016-06-06 19:48:25 +02:00
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
2016-06-14 01:24:01 +02:00
|
|
|
class WithAtomics extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case UseAtomics => true
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithPrefetches extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case "COMPARATOR_PREFETCHES" => true
|
|
|
|
})
|
|
|
|
|
2015-12-06 12:01:05 +01:00
|
|
|
class WithMemtest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestCachedClients => 1
|
|
|
|
case GroundTestUncachedClients => 1
|
|
|
|
case GroundTestNPTW => 0
|
2015-12-06 12:01:05 +01:00
|
|
|
case MaxGenerateRequests => 128
|
2016-06-14 01:24:01 +02:00
|
|
|
case GeneratorStartAddress => site(TohostAddr) + BigInt(site(CacheBlockBytes))
|
2015-12-06 12:01:05 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new GeneratorTest(id)(p))
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-12-06 12:01:05 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithCacheFillTest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestUncachedClients => 1
|
2015-12-06 12:01:05 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new CacheFillTest()(p))
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-12-06 12:01:05 +01:00
|
|
|
},
|
|
|
|
knobValues = {
|
|
|
|
case "L2_WAYS" => 4
|
|
|
|
case "L2_CAPACITY_IN_KB" => 4
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-12-06 12:01:05 +01:00
|
|
|
})
|
|
|
|
|
2015-12-15 05:01:22 +01:00
|
|
|
class WithBroadcastRegressionTest extends Config(
|
2015-12-06 12:01:05 +01:00
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestCachedClients => 1
|
|
|
|
case GroundTestUncachedClients => 1
|
2015-12-06 12:01:05 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new RegressionTest()(p))
|
2015-12-15 05:01:22 +01:00
|
|
|
case GroundTestRegressions =>
|
|
|
|
(p: Parameters) => RegressionTests.broadcastRegressions(p)
|
2015-12-17 06:06:39 +01:00
|
|
|
case GroundTestMaxXacts => 3
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-12-15 05:01:22 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithCacheRegressionTest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestCachedClients => 1
|
|
|
|
case GroundTestUncachedClients => 1
|
2015-12-15 05:01:22 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new RegressionTest()(p))
|
|
|
|
case GroundTestRegressions =>
|
|
|
|
(p: Parameters) => RegressionTests.cacheRegressions(p)
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestMaxXacts => 5
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-12-06 12:01:05 +01:00
|
|
|
})
|
|
|
|
|
2015-11-18 03:21:52 +01:00
|
|
|
class WithDmaTest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestNPTW => 1
|
|
|
|
case GroundTestUncachedClients => 1
|
2015-11-18 03:21:52 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new DmaTest()(p))
|
|
|
|
case DmaTestSet => DmaTestCases(
|
|
|
|
(0x00001FF0, 0x00002FF4, 72),
|
|
|
|
(0x00001FF4, 0x00002FF0, 72),
|
|
|
|
(0x00001FF0, 0x00002FE0, 72),
|
|
|
|
(0x00001FE0, 0x00002FF0, 72),
|
|
|
|
(0x00884DA4, 0x008836C0, 40),
|
|
|
|
(0x00800008, 0x00800008, 64))
|
|
|
|
case DmaTestDataStart => 0x3012CC00
|
|
|
|
case DmaTestDataStride => 8
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2015-11-18 03:21:52 +01:00
|
|
|
})
|
|
|
|
|
2016-01-07 06:38:35 +01:00
|
|
|
class WithDmaStreamTest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestNPTW => 1
|
|
|
|
case GroundTestUncachedClients => 1
|
2016-01-07 06:38:35 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new DmaStreamTest()(p))
|
|
|
|
case DmaStreamTestSettings => DmaStreamTestConfig(
|
|
|
|
source = 0x10, dest = 0x28, len = 0x18,
|
|
|
|
size = site(StreamLoopbackWidth) / 8)
|
2016-03-25 03:52:12 +01:00
|
|
|
case GroundTestCSRs =>
|
|
|
|
Seq(DmaCtrlRegNumbers.CSR_BASE + DmaCtrlRegNumbers.OUTSTANDING)
|
2016-06-08 01:13:01 +02:00
|
|
|
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-06-14 01:24:01 +02:00
|
|
|
case GroundTestUncachedClients => 1
|
2016-02-10 20:12:39 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new NastiConverterTest()(p))
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-02-10 20:12:39 +01:00
|
|
|
})
|
|
|
|
|
2016-02-19 22:30:20 +01:00
|
|
|
class WithUnitTest extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new UnitTestSuite()(p))
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-02-19 22:30:20 +01:00
|
|
|
})
|
|
|
|
|
2016-02-22 19:04:38 +01:00
|
|
|
class WithTraceGen extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
2016-06-14 01:24:01 +02:00
|
|
|
case GroundTestCachedClients => 1
|
2016-02-22 19:04:38 +01:00
|
|
|
case BuildGroundTest =>
|
|
|
|
(id: Int, p: Parameters) => Module(new GroundTestTraceGenerator(id)(p))
|
|
|
|
case MaxGenerateRequests => 128
|
|
|
|
case AddressBag => List(0x8, 0x10, 0x108, 0x100008)
|
2016-06-08 01:13:01 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-02-22 19:04:38 +01:00
|
|
|
})
|
|
|
|
|
2016-06-06 19:48:25 +02:00
|
|
|
class ComparatorConfig extends Config(new WithComparator ++ new BaseConfig)
|
2016-06-14 01:24:01 +02:00
|
|
|
class ComparatorL2Config extends Config(
|
|
|
|
new WithAtomics ++ new WithPrefetches ++
|
|
|
|
new WithL2Cache ++ new ComparatorConfig)
|
2016-05-25 20:08:11 +02:00
|
|
|
class GroundTestConfig extends Config(new WithGroundTest ++ new BaseConfig)
|
2015-12-06 12:01:05 +01:00
|
|
|
class MemtestConfig extends Config(new WithMemtest ++ new GroundTestConfig)
|
|
|
|
class MemtestL2Config extends Config(
|
|
|
|
new WithMemtest ++ new WithL2Cache ++ new GroundTestConfig)
|
|
|
|
class CacheFillTestConfig extends Config(
|
2016-05-03 22:39:04 +02:00
|
|
|
new WithCacheFillTest ++ new WithPLRU ++ new WithL2Cache ++ new GroundTestConfig)
|
2015-12-15 05:01:22 +01:00
|
|
|
class BroadcastRegressionTestConfig extends Config(
|
|
|
|
new WithBroadcastRegressionTest ++ new GroundTestConfig)
|
|
|
|
class CacheRegressionTestConfig extends Config(
|
|
|
|
new WithCacheRegressionTest ++ new WithL2Cache ++ new GroundTestConfig)
|
2015-11-18 03:21:52 +01:00
|
|
|
class DmaTestConfig extends Config(new WithDmaTest ++ new WithL2Cache ++ new GroundTestConfig)
|
2016-01-07 06:38:35 +01:00
|
|
|
class DmaStreamTestConfig extends Config(new WithDmaStreamTest ++ new WithStreamLoopback ++ new WithL2Cache ++ new GroundTestConfig)
|
2016-02-10 20:12:39 +01:00
|
|
|
class NastiConverterTestConfig extends Config(new WithNastiConverterTest ++ new GroundTestConfig)
|
2016-02-19 22:30:20 +01:00
|
|
|
class UnitTestConfig extends Config(new WithUnitTest ++ new GroundTestConfig)
|
2016-06-14 01:24:01 +02:00
|
|
|
class TraceGenConfig extends Config(new WithNCores(2) ++ new WithL2Cache ++ new WithTraceGen ++ new GroundTestConfig)
|
|
|
|
|
|
|
|
class WithNCachedGenerators(n: Int) extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case GroundTestCachedClients => n
|
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNUncachedGenerators(n: Int) extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case GroundTestUncachedClients => n
|
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
2015-12-06 12:01:05 +01:00
|
|
|
|
|
|
|
class FancyMemtestConfig extends Config(
|
2016-06-14 01:24:01 +02:00
|
|
|
new WithNCachedGenerators(1) ++ new WithNUncachedGenerators(2) ++
|
|
|
|
new WithNCores(2) ++
|
|
|
|
new WithNMemoryChannels(2) ++ new WithNBanksPerMemChannel(4) ++
|
2015-12-06 12:01:05 +01:00
|
|
|
new WithMemtest ++ new WithL2Cache ++ new GroundTestConfig)
|