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
|
|
|
|
2017-07-07 19:48:16 +02:00
|
|
|
package freechips.rocketchip.coreplex
|
2016-08-11 02:20:00 +02:00
|
|
|
|
|
|
|
import Chisel._
|
2017-07-07 19:48:16 +02:00
|
|
|
import freechips.rocketchip.config._
|
|
|
|
import freechips.rocketchip.devices.debug._
|
|
|
|
import freechips.rocketchip.devices.tilelink._
|
|
|
|
import freechips.rocketchip.diplomacy._
|
|
|
|
import freechips.rocketchip.rocket._
|
|
|
|
import freechips.rocketchip.tile._
|
|
|
|
import freechips.rocketchip.tilelink._
|
|
|
|
import freechips.rocketchip.util._
|
2016-08-11 02:20:00 +02:00
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class BaseCoreplexConfig extends Config ((site, here, up) => {
|
2017-07-23 17:31:04 +02:00
|
|
|
// Tile parameters
|
2017-01-13 23:41:19 +01:00
|
|
|
case PAddrBits => 32
|
|
|
|
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
2017-02-27 23:27:19 +01:00
|
|
|
case ASIdBits => 0
|
2017-02-09 22:59:09 +01:00
|
|
|
case XLen => 64 // Applies to all cores
|
2017-04-28 00:22:52 +02:00
|
|
|
case ResetVectorBits => site(PAddrBits)
|
2017-07-07 19:48:16 +02:00
|
|
|
case MaxHartIdBits => log2Up(site(RocketTilesKey).size)
|
2017-02-09 22:59:09 +01:00
|
|
|
case BuildCore => (p: Parameters) => new Rocket()(p)
|
2017-07-23 17:31:04 +02:00
|
|
|
case RocketTilesKey => Nil // Will be added by partial configs found below
|
|
|
|
// Interconnect parameters
|
2017-04-20 01:16:05 +02:00
|
|
|
case RocketCrossing => SynchronousCrossing()
|
2017-07-23 17:31:04 +02:00
|
|
|
case BroadcastParams => BroadcastParams()
|
|
|
|
case BankedL2Params => BankedL2Params()
|
|
|
|
case SystemBusParams => SystemBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
|
|
|
|
case PeripheryBusParams => PeripheryBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
|
|
|
|
case MemoryBusParams => MemoryBusParams(beatBytes = 8, blockBytes = site(CacheBlockBytes))
|
2017-01-13 23:41:19 +01:00
|
|
|
case CacheBlockBytes => 64
|
2017-07-23 17:31:04 +02:00
|
|
|
// Device parameters
|
|
|
|
case DebugModuleParams => DefaultDebugModuleParams(site(XLen))
|
|
|
|
case PLICParams => PLICParams()
|
|
|
|
case ClintParams => ClintParams()
|
2017-07-25 09:55:55 +02:00
|
|
|
case DTSTimebase => BigInt(1000000) // 1 MHz
|
2017-07-23 17:31:04 +02:00
|
|
|
// TileLink connection global parameters
|
|
|
|
case TLMonitorBuilder => (args: TLMonitorArgs) => Some(LazyModule(new TLMonitor(args)))
|
|
|
|
case TLCombinationalCheck => false
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
2017-07-23 17:31:04 +02:00
|
|
|
/* Composable partial function Configs to set individual parameters */
|
|
|
|
|
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(
|
2017-07-23 17:31:04 +02:00
|
|
|
rowBits = site(SystemBusParams).beatBits,
|
|
|
|
nMSHRs = 0,
|
2017-03-07 06:35:45 +01:00
|
|
|
blockBytes = site(CacheBlockBytes))),
|
|
|
|
icache = Some(ICacheParams(
|
2017-07-23 17:31:04 +02:00
|
|
|
rowBits = site(SystemBusParams).beatBits,
|
2017-03-07 06:35:45 +01:00
|
|
|
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(
|
2017-07-23 17:31:04 +02:00
|
|
|
rowBits = site(SystemBusParams).beatBits,
|
2017-03-07 06:35:45 +01:00
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
nMSHRs = 0,
|
|
|
|
blockBytes = site(CacheBlockBytes))),
|
|
|
|
icache = Some(ICacheParams(
|
2017-07-23 17:31:04 +02:00
|
|
|
rowBits = site(SystemBusParams).beatBits,
|
2017-03-07 06:35:45 +01:00
|
|
|
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
|
|
|
})
|
|
|
|
|
2017-07-23 17:31:04 +02:00
|
|
|
class WithNTinyCores(n: Int) extends Config((site, here, up) => {
|
|
|
|
case XLen => 32
|
|
|
|
case RocketTilesKey => {
|
|
|
|
val tiny = RocketTileParams(
|
|
|
|
core = RocketCoreParams(
|
|
|
|
useVM = false,
|
|
|
|
fpu = None,
|
|
|
|
mulDiv = Some(MulDivParams(mulUnroll = 8))),
|
|
|
|
btb = None,
|
|
|
|
dcache = Some(DCacheParams(
|
|
|
|
rowBits = site(SystemBusParams).beatBits,
|
|
|
|
nSets = 256, // 16Kb scratchpad
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
nMSHRs = 0,
|
|
|
|
blockBytes = site(CacheBlockBytes),
|
|
|
|
scratch = Some(0x80000000L))),
|
|
|
|
icache = Some(ICacheParams(
|
|
|
|
rowBits = site(SystemBusParams).beatBits,
|
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
blockBytes = site(CacheBlockBytes))))
|
|
|
|
List.fill(n)(tiny) ++ up(RocketTilesKey, site)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithNBanksPerMemChannel(n: Int) extends Config((site, here, up) => {
|
2017-07-23 17:31:04 +02:00
|
|
|
case BankedL2Params => up(BankedL2Params, site).copy(nBanksPerChannel = n)
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithNTrackersPerBank(n: Int) extends Config((site, here, up) => {
|
2017-07-23 17:31:04 +02:00
|
|
|
case BroadcastParams => up(BroadcastParams, site).copy(nTrackers = n)
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
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-01-13 23:41:19 +01:00
|
|
|
class WithBufferlessBroadcastHub extends Config((site, here, up) => {
|
2017-07-23 17:31:04 +02:00
|
|
|
case BroadcastParams => up(BroadcastParams, site).copy(bufferless = true)
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
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-07-23 17:31:04 +02:00
|
|
|
case BankedL2Params => up(BankedL2Params, 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-07-23 17:31:04 +02:00
|
|
|
(cork.node, cork.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
|
|
|
})
|
|
|
|
|
2017-03-15 23:23:30 +01:00
|
|
|
class WithNonblockingL1(nMSHRs: Int) extends Config((site, here, up) => {
|
2017-02-09 22:59:09 +01:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
2017-03-15 23:23:30 +01:00
|
|
|
r.copy(dcache = r.dcache.map(_.copy(nMSHRs = nMSHRs)))
|
2017-02-09 22:59:09 +01:00
|
|
|
}
|
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) => {
|
2017-05-17 01:44:53 +02:00
|
|
|
case RocketTilesKey => up(RocketTilesKey, site) map { r =>
|
2017-06-22 21:07:09 +02:00
|
|
|
r.copy(rocc =
|
|
|
|
Seq(
|
|
|
|
RoCCParams(
|
|
|
|
opcodes = OpcodeSet.custom0,
|
|
|
|
generator = (p: Parameters) => LazyModule(new AccumulatorExample()(p))),
|
|
|
|
RoCCParams(
|
|
|
|
opcodes = OpcodeSet.custom1,
|
|
|
|
generator = (p: Parameters) => LazyModule(new TranslatorExample()(p)),
|
|
|
|
nPTWPorts = 1),
|
|
|
|
RoCCParams(
|
|
|
|
opcodes = OpcodeSet.custom2,
|
|
|
|
generator = (p: Parameters) => LazyModule(new CharacterCountExample()(p)))
|
|
|
|
))
|
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
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) => {
|
2017-07-23 17:31:04 +02:00
|
|
|
case BootROMParams => up(BootROMParams, site).copy(contentFileName = bootROMFile)
|
2017-01-17 20:57:23 +01:00
|
|
|
})
|
2017-01-28 02:09:43 +01:00
|
|
|
|
|
|
|
class WithSynchronousRocketTiles extends Config((site, here, up) => {
|
2017-04-20 01:16:05 +02:00
|
|
|
case RocketCrossing => SynchronousCrossing()
|
2017-01-28 02:09:43 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithAynchronousRocketTiles(depth: Int, sync: Int) extends Config((site, here, up) => {
|
2017-04-20 01:16:05 +02:00
|
|
|
case RocketCrossing => AsynchronousCrossing(depth, sync)
|
2017-01-28 02:09:43 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithRationalRocketTiles extends Config((site, here, up) => {
|
2017-04-20 01:16:05 +02:00
|
|
|
case RocketCrossing => RationalCrossing()
|
2017-01-28 02:09:43 +01:00
|
|
|
})
|
2017-05-17 07:56:58 +02:00
|
|
|
|
2017-07-23 17:31:04 +02:00
|
|
|
class WithEdgeDataBits(dataBits: Int) extends Config((site, here, up) => {
|
|
|
|
case MemoryBusParams => up(MemoryBusParams, site).copy(beatBytes = dataBits/8)
|
|
|
|
case ExtIn => up(ExtIn, site).copy(beatBytes = dataBits/8)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithJtagDTM extends Config ((site, here, up) => {
|
|
|
|
case IncludeJtagDTM => true
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNoPeripheryArithAMO extends Config ((site, here, up) => {
|
|
|
|
case PeripheryBusParams => up(PeripheryBusParams, site).copy(arithmetic = false)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNBitPeripheryBus(nBits: Int) extends Config ((site, here, up) => {
|
|
|
|
case PeripheryBusParams => up(PeripheryBusParams, site).copy(beatBytes = nBits/8)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithoutTLMonitors extends Config ((site, here, up) => {
|
|
|
|
case TLMonitorBuilder => (args: TLMonitorArgs) => None
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNExtTopInterrupts(nExtInts: Int) extends Config((site, here, up) => {
|
|
|
|
case NExtTopInterrupts => nExtInts
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNMemoryChannels(n: Int) extends Config((site, here, up) => {
|
|
|
|
case BankedL2Params => up(BankedL2Params, site).copy(nMemoryChannels = n)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithExtMemSize(n: Long) extends Config((site, here, up) => {
|
|
|
|
case ExtMem => up(ExtMem, site).copy(size = n)
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithDTS(model: String, compat: Seq[String]) extends Config((site, here, up) => {
|
|
|
|
case DTSModel => model
|
|
|
|
case DTSCompat => compat
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithTimebase(hertz: BigInt) extends Config((site, here, up) => {
|
|
|
|
case DTSTimebase => hertz
|
|
|
|
})
|