2016-08-11 02:20:00 +02:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
|
|
|
package coreplex
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import junctions._
|
2016-10-27 04:02:04 +02:00
|
|
|
import diplomacy._
|
2016-08-11 02:20:00 +02:00
|
|
|
import uncore.tilelink._
|
2016-11-18 02:26:49 +01:00
|
|
|
import uncore.tilelink2._
|
2016-08-11 02:20:00 +02:00
|
|
|
import uncore.coherence._
|
|
|
|
import uncore.agents._
|
|
|
|
import uncore.devices._
|
|
|
|
import uncore.converters._
|
|
|
|
import rocket._
|
2016-09-28 06:27:07 +02:00
|
|
|
import util._
|
2016-09-15 22:04:01 +02:00
|
|
|
import util.ConfigUtils._
|
2016-11-18 23:05:14 +01:00
|
|
|
import config._
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
class BaseCoreplexConfig extends Config (
|
2016-11-18 21:02:33 +01:00
|
|
|
{ (pname,site,here) =>
|
2016-09-02 23:56:00 +02:00
|
|
|
lazy val innerDataBits = site(XLen)
|
2016-08-11 02:20:00 +02:00
|
|
|
lazy val innerDataBeats = (8 * site(CacheBlockBytes)) / innerDataBits
|
|
|
|
pname match {
|
|
|
|
//Memory Parameters
|
|
|
|
case PAddrBits => 32
|
|
|
|
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
|
|
|
case ASIdBits => 7
|
|
|
|
//Params used by all caches
|
2016-11-18 21:02:33 +01:00
|
|
|
case CacheName("L1I") => CacheConfig(
|
|
|
|
nSets = 64,
|
|
|
|
nWays = 4,
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nTLBEntries = 8,
|
|
|
|
cacheIdBits = 0,
|
|
|
|
splitMetadata = false)
|
|
|
|
case CacheName("L1D") => CacheConfig(
|
|
|
|
nSets = 64,
|
|
|
|
nWays = 4,
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nTLBEntries = 8,
|
|
|
|
cacheIdBits = 0,
|
|
|
|
splitMetadata = false)
|
2016-08-11 02:20:00 +02:00
|
|
|
case ECCCode => None
|
2016-11-18 21:02:33 +01:00
|
|
|
case Replacer => () => new RandomReplacement(site(site(CacheName)).nWays)
|
2016-08-11 02:20:00 +02:00
|
|
|
//L1InstCache
|
|
|
|
case BtbKey => BtbParameters()
|
|
|
|
//L1DataCache
|
2016-11-18 21:02:33 +01:00
|
|
|
case DCacheKey => DCacheConfig(nMSHRs = 2)
|
2016-09-03 00:59:16 +02:00
|
|
|
case DataScratchpadSize => 0
|
2016-08-11 02:20:00 +02:00
|
|
|
//L2 Memory System Params
|
2016-08-17 05:04:02 +02:00
|
|
|
case AmoAluOperandBits => site(XLen)
|
2016-08-11 02:20:00 +02:00
|
|
|
case NAcquireTransactors => 7
|
|
|
|
case L2StoreDataQueueDepth => 1
|
|
|
|
case L2DirectoryRepresentation => new NullRepresentation(site(NTiles))
|
|
|
|
//Tile Constants
|
|
|
|
case BuildRoCC => Nil
|
|
|
|
case RoccNMemChannels => site(BuildRoCC).map(_.nMemChannels).foldLeft(0)(_ + _)
|
|
|
|
case RoccNPTWPorts => site(BuildRoCC).map(_.nPTWPorts).foldLeft(0)(_ + _)
|
|
|
|
//Rocket Core Constants
|
2016-08-17 05:04:02 +02:00
|
|
|
case CoreInstBits => if (site(UseCompressed)) 16 else 32
|
2016-08-11 02:20:00 +02:00
|
|
|
case FetchWidth => if (site(UseCompressed)) 2 else 1
|
|
|
|
case RetireWidth => 1
|
|
|
|
case UseVM => true
|
2016-10-09 05:49:36 +02:00
|
|
|
case UseUser => false
|
2016-08-11 02:20:00 +02:00
|
|
|
case UseDebug => true
|
|
|
|
case NBreakpoints => 1
|
2016-08-27 05:27:27 +02:00
|
|
|
case NPerfCounters => 0
|
|
|
|
case NPerfEvents => 0
|
2016-08-11 02:20:00 +02:00
|
|
|
case FastLoadWord => true
|
|
|
|
case FastLoadByte => false
|
2016-09-13 11:32:00 +02:00
|
|
|
case FastJAL => false
|
2016-08-11 02:20:00 +02:00
|
|
|
case XLen => 64
|
2016-08-17 09:57:35 +02:00
|
|
|
case FPUKey => Some(FPUConfig())
|
2016-09-13 01:50:08 +02:00
|
|
|
case MulDivKey => Some(MulDivConfig(mulUnroll = 8, mulEarlyOut = (site(XLen) > 32), divEarlyOut = true))
|
2016-08-17 09:57:35 +02:00
|
|
|
case UseAtomics => true
|
|
|
|
case UseCompressed => true
|
2016-08-11 02:20:00 +02:00
|
|
|
case DMKey => new DefaultDebugModuleConfig(site(NTiles), site(XLen))
|
|
|
|
case NCustomMRWCSRs => 0
|
2016-09-29 22:52:41 +02:00
|
|
|
case MtvecInit => Some(BigInt(0))
|
2016-08-11 02:20:00 +02:00
|
|
|
case MtvecWritable => true
|
|
|
|
//Uncore Paramters
|
|
|
|
case LNEndpoints => site(TLKey(site(TLId))).nManagers + site(TLKey(site(TLId))).nClients
|
|
|
|
case LNHeaderBits => log2Ceil(site(TLKey(site(TLId))).nManagers) +
|
|
|
|
log2Up(site(TLKey(site(TLId))).nClients)
|
2016-11-17 23:07:53 +01:00
|
|
|
case CBusConfig => TLBusConfig(beatBytes = site(XLen)/8)
|
|
|
|
case L1toL2Config => TLBusConfig(beatBytes = site(XLen)/8) // increase for more PCIe bandwidth
|
2016-08-11 02:20:00 +02:00
|
|
|
case TLKey("L1toL2") => {
|
2016-11-11 22:07:45 +01:00
|
|
|
val useMEI = site(NTiles) <= 1
|
2016-08-11 02:20:00 +02:00
|
|
|
TileLinkParameters(
|
|
|
|
coherencePolicy = (
|
|
|
|
if (useMEI) new MEICoherence(site(L2DirectoryRepresentation))
|
|
|
|
else new MESICoherence(site(L2DirectoryRepresentation))),
|
2016-11-18 02:26:49 +01:00
|
|
|
nManagers = site(BankedL2Config).nBanks + 1 /* MMIO */,
|
2016-11-11 22:07:45 +01:00
|
|
|
nCachingClients = 1,
|
2016-11-16 03:27:52 +01:00
|
|
|
nCachelessClients = 1,
|
2016-08-11 02:20:00 +02:00
|
|
|
maxClientXacts = max_int(
|
|
|
|
// L1 cache
|
2016-08-18 01:53:39 +02:00
|
|
|
site(DCacheKey).nMSHRs + 1 /* IOMSHR */,
|
2016-08-11 02:20:00 +02:00
|
|
|
// RoCC
|
|
|
|
if (site(BuildRoCC).isEmpty) 1 else site(RoccMaxTaggedMemXacts)),
|
|
|
|
maxClientsPerPort = if (site(BuildRoCC).isEmpty) 1 else 2,
|
|
|
|
maxManagerXacts = site(NAcquireTransactors) + 2,
|
|
|
|
dataBeats = innerDataBeats,
|
|
|
|
dataBits = site(CacheBlockBytes)*8)
|
|
|
|
}
|
|
|
|
case BootROMFile => "./bootrom/bootrom.img"
|
2016-09-13 20:29:26 +02:00
|
|
|
case NTiles => 1
|
2016-11-18 02:26:49 +01:00
|
|
|
case BroadcastConfig => BroadcastConfig()
|
|
|
|
case BankedL2Config => BankedL2Config()
|
2016-11-18 21:02:33 +01:00
|
|
|
case CacheBlockBytes => 64
|
2016-08-11 02:20:00 +02:00
|
|
|
case CacheBlockOffsetBits => log2Up(here(CacheBlockBytes))
|
|
|
|
case EnableL2Logging => false
|
|
|
|
case _ => throw new CDEMatchError
|
2016-11-18 21:02:33 +01:00
|
|
|
}
|
2016-08-11 02:20:00 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
class WithNCores(n: Int) extends Config(
|
2016-09-13 20:29:26 +02:00
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case NTiles => n
|
2016-11-19 03:19:31 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-09-13 20:29:26 +02:00
|
|
|
})
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
class WithNBanksPerMemChannel(n: Int) extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case BankedL2Config => up(BankedL2Config).copy(nBanksPerChannel = n)
|
2016-08-11 02:20:00 +02:00
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
2016-11-04 03:48:05 +01:00
|
|
|
class WithNTrackersPerBank(n: Int) extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case BroadcastConfig => up(BroadcastConfig).copy(nTrackers = n)
|
2016-11-04 03:48:05 +01:00
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
2016-11-18 19:49:42 +01:00
|
|
|
// This is the number of sets **per way**
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithL1ICacheSets(sets: Int) extends Config(
|
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case CacheName("L1I") => up(CacheName("L1I")).copy(nSets = sets)
|
2016-11-18 19:49:42 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
|
|
|
// This is the number of sets **per way**
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithL1DCacheSets(sets: Int) extends Config(
|
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = sets)
|
2016-11-18 19:49:42 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithL1ICacheWays(ways: Int) extends Config(
|
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case CacheName("L1I") => up(CacheName("L1I")).copy(nWays = ways)
|
2016-11-18 19:49:42 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithL1DCacheWays(ways: Int) extends Config(
|
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case CacheName("L1D") => up(CacheName("L1D")).copy(nWays = ways)
|
2016-11-18 19:49:42 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithCacheBlockBytes(linesize: Int) extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case CacheBlockBytes => linesize
|
2016-11-18 19:49:42 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-04 03:48:05 +01:00
|
|
|
})
|
|
|
|
|
2016-09-03 00:59:16 +02:00
|
|
|
class WithDataScratchpad(n: Int) extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname,site,here,up) => pname match {
|
2016-09-03 00:59:16 +02:00
|
|
|
case DataScratchpadSize => n
|
2016-11-18 21:52:36 +01:00
|
|
|
case CacheName("L1D") => up(CacheName("L1D")).copy(nSets = n / site(CacheBlockBytes))
|
2016-09-03 00:59:16 +02:00
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
2016-11-18 21:02:33 +01:00
|
|
|
// TODO: re-add L2
|
2016-08-11 02:20:00 +02:00
|
|
|
class WithL2Cache extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
2016-11-18 21:02:33 +01:00
|
|
|
case CacheName("L2") => CacheConfig(
|
|
|
|
nSets = 1024,
|
|
|
|
nWays = 1,
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nTLBEntries = 0,
|
|
|
|
cacheIdBits = 1,
|
|
|
|
splitMetadata = false)
|
2016-08-11 02:20:00 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-18 21:02:33 +01:00
|
|
|
})
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
class WithBufferlessBroadcastHub extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname, site, here, up) => pname match {
|
|
|
|
case BroadcastConfig => up(BroadcastConfig).copy(bufferless = true)
|
2016-08-11 02:20:00 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WARNING!!! IGNORE AT YOUR OWN PERIL!!!
|
|
|
|
*
|
|
|
|
* There is a very restrictive set of conditions under which the stateless
|
|
|
|
* bridge will function properly. There can only be a single tile. This tile
|
|
|
|
* MUST use the blocking data cache (L1D_MSHRS == 0) and MUST NOT have an
|
|
|
|
* uncached channel capable of writes (i.e. a RoCC accelerator).
|
|
|
|
*
|
|
|
|
* This is because the stateless bridge CANNOT generate probes, so if your
|
|
|
|
* system depends on coherence between channels in any way,
|
|
|
|
* DO NOT use this configuration.
|
|
|
|
*/
|
2016-11-18 21:02:33 +01:00
|
|
|
class WithStatelessBridge extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname,site,here,up) => pname match {
|
2016-11-19 01:23:16 +01:00
|
|
|
/* !!! FIXME
|
2016-11-18 21:52:36 +01:00
|
|
|
case BankedL2Config => up(BankedL2Config).copy(coherenceManager = { case (_, _) =>
|
2016-11-18 02:26:49 +01:00
|
|
|
val pass = LazyModule(new TLBuffer(0))
|
|
|
|
(pass.node, pass.node)
|
|
|
|
})
|
2016-11-19 01:23:16 +01:00
|
|
|
*/
|
2016-11-18 21:52:36 +01:00
|
|
|
case DCacheKey => up(DCacheKey).copy(nMSHRs = 0)
|
2016-11-18 02:26:49 +01:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-18 21:02:33 +01:00
|
|
|
})
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
class WithPLRU extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithL2Capacity(size_kb: Int) extends Config(
|
2016-11-18 21:02:33 +01:00
|
|
|
(pname,site,here) => pname match {
|
2016-08-11 02:20:00 +02:00
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNL2Ways(n: Int) extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname,site,here,up) => pname match {
|
|
|
|
case CacheName("L2") => up(CacheName("L2")).copy(nWays = n)
|
2016-08-11 02:20:00 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithRV32 extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case XLen => 32
|
2016-09-07 08:53:12 +02:00
|
|
|
case FPUKey => Some(FPUConfig(divSqrt = false))
|
2016-08-11 02:20:00 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-18 21:02:33 +01:00
|
|
|
})
|
2016-08-11 02:20:00 +02:00
|
|
|
|
2016-11-18 21:02:33 +01:00
|
|
|
class WithBlockingL1 extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname,site,here,up) => pname match {
|
|
|
|
case DCacheKey => up(DCacheKey).copy(nMSHRs = 0)
|
2016-08-11 02:20:00 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-18 21:02:33 +01:00
|
|
|
})
|
2016-08-11 02:20:00 +02:00
|
|
|
|
2016-11-18 21:02:33 +01:00
|
|
|
class WithSmallCores extends Config(
|
2016-11-18 21:52:36 +01:00
|
|
|
(pname,site,here,up) => pname match {
|
2016-09-07 10:58:25 +02:00
|
|
|
case MulDivKey => Some(MulDivConfig())
|
|
|
|
case FPUKey => None
|
|
|
|
case UseVM => false
|
|
|
|
case BtbKey => BtbParameters(nEntries = 0)
|
|
|
|
case NAcquireTransactors => 2
|
2016-11-18 21:52:36 +01:00
|
|
|
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)
|
2016-09-07 10:58:25 +02:00
|
|
|
case _ => throw new CDEMatchError
|
2016-11-18 21:02:33 +01:00
|
|
|
})
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
class WithRoccExample extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case BuildRoCC => Seq(
|
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom0,
|
|
|
|
generator = (p: Parameters) => Module(new AccumulatorExample()(p))),
|
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom1,
|
|
|
|
generator = (p: Parameters) => Module(new TranslatorExample()(p)),
|
|
|
|
nPTWPorts = 1),
|
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom2,
|
|
|
|
generator = (p: Parameters) => Module(new CharacterCountExample()(p))))
|
|
|
|
|
|
|
|
case RoccMaxTaggedMemXacts => 1
|
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithDefaultBtb extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
2016-11-18 19:49:42 +01:00
|
|
|
case BtbKey => BtbParameters()
|
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithFastMulDiv extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
2016-11-18 19:49:42 +01:00
|
|
|
case MulDivKey => Some(MulDivConfig(mulUnroll = 8, mulEarlyOut = (site(XLen) > 32), divEarlyOut = true))
|
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2016-11-19 03:19:31 +01:00
|
|
|
class WithoutMulDiv extends Config(
|
2016-11-18 19:49:42 +01:00
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case MulDivKey => None
|
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
|
|
|
class WithoutFPU extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case FPUKey => None
|
|
|
|
case _ => throw new CDEMatchError
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithFPUWithoutDivSqrt extends Config (
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case FPUKey => Some(FPUConfig(divSqrt = false))
|
|
|
|
case _ => throw new CDEMatchError
|
2016-11-19 03:19:31 +01:00
|
|
|
})
|