2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
// See LICENSE.Berkeley for license details.
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
package coreplex
|
|
|
|
|
|
|
|
import Chisel._
|
2016-12-05 19:42:16 +01:00
|
|
|
import config._
|
2016-10-27 04:02:04 +02:00
|
|
|
import diplomacy._
|
2016-12-05 19:42:16 +01:00
|
|
|
import rocket._
|
2016-08-11 02:20:00 +02:00
|
|
|
import uncore.converters._
|
2017-01-17 03:24:08 +01:00
|
|
|
import uncore.devices._
|
|
|
|
import uncore.tilelink2._
|
2016-11-22 20:50:41 +01:00
|
|
|
import uncore.util._
|
2016-09-28 06:27:07 +02:00
|
|
|
import util._
|
2016-08-11 02:20:00 +02:00
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class BaseCoreplexConfig extends Config ((site, here, up) => {
|
|
|
|
//Memory Parameters
|
|
|
|
case PAddrBits => 32
|
|
|
|
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
|
|
|
case ASIdBits => 7
|
|
|
|
//Params used by all caches
|
|
|
|
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)
|
|
|
|
case ECCCode => None
|
|
|
|
case Replacer => () => new RandomReplacement(site(site(CacheName)).nWays)
|
|
|
|
//L1InstCache
|
|
|
|
case BtbKey => BtbParameters()
|
|
|
|
//L1DataCache
|
|
|
|
case DCacheKey => DCacheConfig(nMSHRs = 2)
|
|
|
|
case DataScratchpadSize => 0
|
|
|
|
//Tile Constants
|
|
|
|
case BuildRoCC => Nil
|
|
|
|
//Rocket Core Constants
|
|
|
|
case CoreInstBits => if (site(UseCompressed)) 16 else 32
|
|
|
|
case FetchWidth => if (site(UseCompressed)) 2 else 1
|
|
|
|
case RetireWidth => 1
|
|
|
|
case UseVM => true
|
|
|
|
case UseUser => false
|
|
|
|
case UseDebug => true
|
|
|
|
case NBreakpoints => 1
|
|
|
|
case NPerfCounters => 0
|
|
|
|
case NPerfEvents => 0
|
|
|
|
case FastLoadWord => true
|
|
|
|
case FastLoadByte => false
|
|
|
|
case FastJAL => false
|
|
|
|
case XLen => 64
|
|
|
|
case FPUKey => Some(FPUConfig())
|
|
|
|
case MulDivKey => Some(MulDivConfig(mulUnroll = 8, mulEarlyOut = (site(XLen) > 32), divEarlyOut = true))
|
|
|
|
case UseAtomics => true
|
|
|
|
case UseCompressed => true
|
|
|
|
case DMKey => new DefaultDebugModuleConfig(site(NTiles), site(XLen))
|
|
|
|
case NCustomMRWCSRs => 0
|
|
|
|
case MtvecInit => Some(BigInt(0))
|
|
|
|
case MtvecWritable => true
|
|
|
|
//Uncore Paramters
|
|
|
|
case CBusConfig => TLBusConfig(beatBytes = site(XLen)/8)
|
|
|
|
case L1toL2Config => TLBusConfig(beatBytes = site(XLen)/8) // increase for more PCIe bandwidth
|
|
|
|
case BootROMFile => "./bootrom/bootrom.img"
|
2017-01-17 03:24:08 +01:00
|
|
|
case NTiles => site(RocketConfigs).size
|
|
|
|
case RocketConfigs => List(RocketConfig(site(XLen)))
|
|
|
|
case BuildCore => (c: RocketConfig, p: Parameters) => new Rocket(c)(p)
|
2017-01-13 23:41:19 +01:00
|
|
|
case BroadcastConfig => BroadcastConfig()
|
|
|
|
case BankedL2Config => BankedL2Config()
|
|
|
|
case CacheBlockBytes => 64
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNCores(n: Int) extends Config((site, here, up) => {
|
|
|
|
case NTiles => n
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNBanksPerMemChannel(n: Int) extends Config((site, here, up) => {
|
|
|
|
case BankedL2Config => up(BankedL2Config, site).copy(nBanksPerChannel = n)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNTrackersPerBank(n: Int) extends Config((site, here, up) => {
|
|
|
|
case BroadcastConfig => up(BroadcastConfig, site).copy(nTrackers = n)
|
|
|
|
})
|
2016-11-04 03:48:05 +01:00
|
|
|
|
2016-11-18 19:49:42 +01:00
|
|
|
// This is the number of sets **per way**
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL1ICacheSets(sets: Int) extends Config((site, here, up) => {
|
|
|
|
case CacheName("L1I") => up(CacheName("L1I"), site).copy(nSets = sets)
|
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
|
|
|
// This is the number of sets **per way**
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL1DCacheSets(sets: Int) extends Config((site, here, up) => {
|
|
|
|
case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = sets)
|
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL1ICacheWays(ways: Int) extends Config((site, here, up) => {
|
|
|
|
case CacheName("L1I") => up(CacheName("L1I"), site).copy(nWays = ways)
|
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL1DCacheWays(ways: Int) extends Config((site, here, up) => {
|
|
|
|
case CacheName("L1D") => up(CacheName("L1D"), site).copy(nWays = ways)
|
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithCacheBlockBytes(linesize: Int) extends Config((site, here, up) => {
|
|
|
|
case CacheBlockBytes => linesize
|
|
|
|
})
|
2016-11-04 03:48:05 +01:00
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithDataScratchpad(n: Int) extends Config((site, here, up) => {
|
|
|
|
case DataScratchpadSize => n
|
|
|
|
case CacheName("L1D") => up(CacheName("L1D"), site).copy(nSets = n / site(CacheBlockBytes))
|
|
|
|
})
|
2016-09-03 00:59:16 +02:00
|
|
|
|
2016-11-18 21:02:33 +01:00
|
|
|
// TODO: re-add L2
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL2Cache extends Config((site, here, up) => {
|
|
|
|
case CacheName("L2") => CacheConfig(
|
|
|
|
nSets = 1024,
|
|
|
|
nWays = 1,
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nTLBEntries = 0,
|
|
|
|
cacheIdBits = 1,
|
|
|
|
splitMetadata = false)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithBufferlessBroadcastHub extends Config((site, here, up) => {
|
|
|
|
case BroadcastConfig => up(BroadcastConfig, site).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.
|
|
|
|
*/
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithStatelessBridge extends Config((site, here, up) => {
|
2016-11-19 01:23:16 +01:00
|
|
|
/* !!! FIXME
|
2016-11-24 03:06:33 +01:00
|
|
|
case BankedL2Config => up(BankedL2Config, site).copy(coherenceManager = { case (_, _) =>
|
2016-12-02 02:46:52 +01:00
|
|
|
val pass = LazyModule(new TLBuffer(0)(site))
|
2016-11-18 02:26:49 +01:00
|
|
|
(pass.node, pass.node)
|
|
|
|
})
|
2016-11-19 01:23:16 +01:00
|
|
|
*/
|
2017-01-13 23:41:19 +01:00
|
|
|
case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
|
|
|
|
})
|
|
|
|
|
2017-01-17 03:24:08 +01:00
|
|
|
class WithL2Capacity(size_kb: Int) extends Config(Parameters.empty) // TODO
|
2017-01-13 23:41:19 +01:00
|
|
|
|
|
|
|
class WithNL2Ways(n: Int) extends Config((site, here, up) => {
|
|
|
|
case CacheName("L2") => up(CacheName("L2"), site).copy(nWays = n)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithRV32 extends Config((site, here, up) => {
|
|
|
|
case XLen => 32
|
|
|
|
case FPUKey => Some(FPUConfig(divSqrt = false))
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithBlockingL1 extends Config((site, here, up) => {
|
|
|
|
case DCacheKey => up(DCacheKey, site).copy(nMSHRs = 0)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithSmallCores extends Config((site, here, up) => {
|
|
|
|
case MulDivKey => Some(MulDivConfig())
|
|
|
|
case FPUKey => None
|
|
|
|
case UseVM => false
|
|
|
|
case BtbKey => BtbParameters(nEntries = 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)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithRoccExample extends Config((site, here, up) => {
|
|
|
|
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
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithDefaultBtb extends Config((site, here, up) => {
|
|
|
|
case BtbKey => BtbParameters()
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithFastMulDiv extends Config((site, here, up) => {
|
|
|
|
case MulDivKey => Some(MulDivConfig(mulUnroll = 8, mulEarlyOut = (site(XLen) > 32), divEarlyOut = true))
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithoutMulDiv extends Config((site, here, up) => {
|
|
|
|
case MulDivKey => None
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithoutFPU extends Config((site, here, up) => {
|
|
|
|
case FPUKey => None
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithFPUWithoutDivSqrt extends Config((site, here, up) => {
|
|
|
|
case FPUKey => Some(FPUConfig(divSqrt = false))
|
|
|
|
})
|
2017-01-17 20:57:23 +01:00
|
|
|
|
|
|
|
class WithBootROMFile(bootROMFile: String) extends Config((site, here, up) => {
|
|
|
|
case BootROMFile => bootROMFile
|
|
|
|
})
|