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._
|
2017-02-09 22:59:09 +01:00
|
|
|
import tile._
|
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) => {
|
|
|
|
case PAddrBits => 32
|
|
|
|
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
|
|
|
case ASIdBits => 7
|
2017-02-09 22:59:09 +01:00
|
|
|
case XLen => 64 // Applies to all cores
|
|
|
|
case BuildCore => (p: Parameters) => new Rocket()(p)
|
2017-01-28 02:09:43 +01:00
|
|
|
case RocketCrossing => Synchronous
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => Nil
|
2017-01-13 23:41:19 +01:00
|
|
|
case DMKey => new DefaultDebugModuleConfig(site(NTiles), site(XLen))
|
2017-02-09 22:59:09 +01:00
|
|
|
case NTiles => site(RocketTilesKey).size
|
2017-01-13 23:41:19 +01:00
|
|
|
case CBusConfig => TLBusConfig(beatBytes = site(XLen)/8)
|
|
|
|
case L1toL2Config => TLBusConfig(beatBytes = site(XLen)/8) // increase for more PCIe bandwidth
|
|
|
|
case BootROMFile => "./bootrom/bootrom.img"
|
|
|
|
case BroadcastConfig => BroadcastConfig()
|
|
|
|
case BankedL2Config => BankedL2Config()
|
|
|
|
case CacheBlockBytes => 64
|
|
|
|
})
|
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
class WithNBigCores(n: Int) extends Config((site, here, up) => {
|
|
|
|
case RocketTilesKey => {
|
|
|
|
val big = RocketTileParams(
|
2017-03-07 06:35:45 +01:00
|
|
|
core = RocketCoreParams(mulDiv = Some(MulDivParams(
|
|
|
|
mulUnroll = 8,
|
|
|
|
mulEarlyOut = true,
|
|
|
|
divEarlyOut = true))),
|
|
|
|
dcache = Some(DCacheParams(
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nMSHRs = 2,
|
|
|
|
blockBytes = site(CacheBlockBytes))),
|
|
|
|
icache = Some(ICacheParams(
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
blockBytes = site(CacheBlockBytes))))
|
2017-02-09 22:59:09 +01:00
|
|
|
List.fill(n)(big) ++ up(RocketTilesKey, site)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNSmallCores(n: Int) extends Config((site, here, up) => {
|
|
|
|
case RocketTilesKey => {
|
|
|
|
val small = RocketTileParams(
|
|
|
|
core = RocketCoreParams(useVM = false, fpu = None),
|
|
|
|
btb = None,
|
2017-03-07 06:35:45 +01:00
|
|
|
dcache = Some(DCacheParams(
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
nMSHRs = 0,
|
|
|
|
blockBytes = site(CacheBlockBytes))),
|
|
|
|
icache = Some(ICacheParams(
|
|
|
|
rowBits = site(L1toL2Config).beatBytes*8,
|
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
blockBytes = site(CacheBlockBytes))))
|
2017-02-09 22:59:09 +01:00
|
|
|
List.fill(n)(small) ++ up(RocketTilesKey, site)
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
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
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
// This is the number of icache sets for all Rocket tiles
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL1ICacheSets(sets: Int) extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(icache = r.icache.map(_.copy(nSets = sets))) }
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
2016-11-18 19:49:42 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
// This is the number of icache sets for all Rocket tiles
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithL1DCacheSets(sets: Int) extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(dcache = r.dcache.map(_.copy(nSets = sets))) }
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
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) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(icache = r.icache.map(_.copy(nWays = ways)))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
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) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(dcache = r.dcache.map(_.copy(nWays = ways)))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
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-02-09 22:59:09 +01:00
|
|
|
class WithL2Cache extends Config(Parameters.empty) // TODO: re-add L2
|
|
|
|
class WithL2Capacity(size_kb: Int) extends Config(Parameters.empty) // TODO: re-add L2
|
|
|
|
class WithNL2Ways(n: Int) extends Config(Parameters.empty) // TODO: re-add L2
|
2017-01-13 23:41:19 +01:00
|
|
|
|
|
|
|
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) => {
|
2017-01-30 23:02:59 +01:00
|
|
|
case BankedL2Config => up(BankedL2Config, site).copy(coherenceManager = { case (q, _) =>
|
2017-01-19 22:51:50 +01:00
|
|
|
implicit val p = q
|
|
|
|
val cork = LazyModule(new TLCacheCork(unsafe = true))
|
2017-01-30 23:02:59 +01:00
|
|
|
val ww = LazyModule(new TLWidthWidget(p(L1toL2Config).beatBytes))
|
|
|
|
ww.node :*= cork.node
|
|
|
|
(cork.node, ww.node)
|
2017-01-19 22:51:50 +01:00
|
|
|
})
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithRV32 extends Config((site, here, up) => {
|
|
|
|
case XLen => 32
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(core = r.core.copy(
|
|
|
|
mulDiv = Some(MulDivParams(mulUnroll = 8)),
|
|
|
|
fpu = r.core.fpu.map(_.copy(divSqrt = false))))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithBlockingL1 extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(dcache = r.dcache.map(_.copy(nMSHRs = 0)))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
class WithNBreakpoints(hwbp: Int) extends Config ((site, here, up) => {
|
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(core = r.core.copy(nBreakpoints = hwbp))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithRoccExample extends Config((site, here, up) => {
|
|
|
|
case BuildRoCC => Seq(
|
2017-02-09 22:59:09 +01:00
|
|
|
RoCCParams(
|
2017-01-13 23:41:19 +01:00
|
|
|
opcodes = OpcodeSet.custom0,
|
|
|
|
generator = (p: Parameters) => Module(new AccumulatorExample()(p))),
|
2017-02-09 22:59:09 +01:00
|
|
|
RoCCParams(
|
2017-01-13 23:41:19 +01:00
|
|
|
opcodes = OpcodeSet.custom1,
|
|
|
|
generator = (p: Parameters) => Module(new TranslatorExample()(p)),
|
|
|
|
nPTWPorts = 1),
|
2017-02-09 22:59:09 +01:00
|
|
|
RoCCParams(
|
2017-01-13 23:41:19 +01:00
|
|
|
opcodes = OpcodeSet.custom2,
|
|
|
|
generator = (p: Parameters) => Module(new CharacterCountExample()(p))))
|
|
|
|
|
|
|
|
case RoccMaxTaggedMemXacts => 1
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithDefaultBtb extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(btb = Some(BTBParams()))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithFastMulDiv extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(core = r.core.copy(mulDiv = Some(
|
|
|
|
MulDivParams(mulUnroll = 8, mulEarlyOut = (site(XLen) > 32), divEarlyOut = true)
|
|
|
|
)))}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithoutMulDiv extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(core = r.core.copy(mulDiv = None))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithoutFPU extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(core = r.core.copy(fpu = None))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithFPUWithoutDivSqrt extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
|
|
|
r.copy(core = r.core.copy(fpu = r.core.fpu.map(_.copy(divSqrt = false))))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
2017-01-17 20:57:23 +01:00
|
|
|
|
|
|
|
class WithBootROMFile(bootROMFile: String) extends Config((site, here, up) => {
|
|
|
|
case BootROMFile => bootROMFile
|
|
|
|
})
|
2017-01-28 02:09:43 +01:00
|
|
|
|
|
|
|
class WithSynchronousRocketTiles extends Config((site, here, up) => {
|
|
|
|
case RocketCrossing => Synchronous
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithAynchronousRocketTiles(depth: Int, sync: Int) extends Config((site, here, up) => {
|
|
|
|
case RocketCrossing => Asynchronous(depth, sync)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithRationalRocketTiles extends Config((site, here, up) => {
|
|
|
|
case RocketCrossing => Rational
|
|
|
|
})
|