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
|
|
|
|
2018-01-12 21:29:27 +01:00
|
|
|
package freechips.rocketchip.subsystem
|
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
|
|
|
|
2018-01-12 21:29:27 +01:00
|
|
|
class BaseSubsystemConfig extends Config ((site, here, up) => {
|
2017-07-23 17:31:04 +02:00
|
|
|
// Tile parameters
|
2017-01-13 23:41:19 +01:00
|
|
|
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
2017-02-09 22:59:09 +01:00
|
|
|
case XLen => 64 // Applies to all cores
|
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
|
|
|
// Interconnect parameters
|
2017-09-09 03:33:44 +02:00
|
|
|
case SystemBusKey => SystemBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
|
|
|
|
case PeripheryBusKey => PeripheryBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
|
2017-09-09 04:08:53 +02:00
|
|
|
case MemoryBusKey => MemoryBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
|
2018-02-21 02:10:16 +01:00
|
|
|
case FrontBusKey => FrontBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
|
2017-09-09 03:33:44 +02:00
|
|
|
// Additional device Parameters
|
2017-12-08 22:41:09 +01:00
|
|
|
case ErrorParams => ErrorParams(Seq(AddressSet(0x3000, 0xfff)), maxAtomic=site(XLen)/8, maxTransfer=4096)
|
2017-09-09 03:33:44 +02:00
|
|
|
case BootROMParams => BootROMParams(contentFileName = "./bootrom/bootrom.img")
|
2017-07-23 17:31:04 +02:00
|
|
|
case DebugModuleParams => DefaultDebugModuleParams(site(XLen))
|
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-09-09 03:33:44 +02:00
|
|
|
rowBits = site(SystemBusKey).beatBits,
|
2017-07-23 17:31:04 +02:00
|
|
|
nMSHRs = 0,
|
2017-03-07 06:35:45 +01:00
|
|
|
blockBytes = site(CacheBlockBytes))),
|
|
|
|
icache = Some(ICacheParams(
|
2017-09-09 03:33:44 +02:00
|
|
|
rowBits = site(SystemBusKey).beatBits,
|
2017-03-07 06:35:45 +01:00
|
|
|
blockBytes = site(CacheBlockBytes))))
|
2017-12-21 02:18:38 +01:00
|
|
|
List.tabulate(n)(i => big.copy(hartId = i))
|
2017-02-09 22:59:09 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
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-09-09 03:33:44 +02:00
|
|
|
rowBits = site(SystemBusKey).beatBits,
|
2017-03-07 06:35:45 +01:00
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
nMSHRs = 0,
|
|
|
|
blockBytes = site(CacheBlockBytes))),
|
|
|
|
icache = Some(ICacheParams(
|
2017-09-09 03:33:44 +02:00
|
|
|
rowBits = site(SystemBusKey).beatBits,
|
2017-03-07 06:35:45 +01:00
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
blockBytes = site(CacheBlockBytes))))
|
2017-12-21 02:18:38 +01:00
|
|
|
List.tabulate(n)(i => small.copy(hartId = i))
|
2017-02-09 22:59:09 +01:00
|
|
|
}
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
2017-10-11 01:24:32 +02:00
|
|
|
class With1TinyCore extends Config((site, here, up) => {
|
|
|
|
case XLen => 32
|
|
|
|
case RocketTilesKey => List(RocketTileParams(
|
|
|
|
core = RocketCoreParams(
|
|
|
|
useVM = false,
|
|
|
|
fpu = None,
|
|
|
|
mulDiv = Some(MulDivParams(mulUnroll = 8))),
|
|
|
|
btb = None,
|
|
|
|
dcache = Some(DCacheParams(
|
|
|
|
rowBits = site(SystemBusKey).beatBits,
|
|
|
|
nSets = 256, // 16Kb scratchpad
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
nMSHRs = 0,
|
|
|
|
blockBytes = site(CacheBlockBytes),
|
|
|
|
scratch = Some(0x80000000L))),
|
|
|
|
icache = Some(ICacheParams(
|
|
|
|
rowBits = site(SystemBusKey).beatBits,
|
|
|
|
nSets = 64,
|
|
|
|
nWays = 1,
|
|
|
|
nTLBEntries = 4,
|
|
|
|
blockBytes = site(CacheBlockBytes)))))
|
|
|
|
case RocketCrossingKey => List(RocketCrossingParams(
|
|
|
|
crossingType = SynchronousCrossing(),
|
|
|
|
master = TileMasterPortParams(cork = Some(true))
|
|
|
|
))
|
2017-07-23 17:31:04 +02:00
|
|
|
})
|
|
|
|
|
2017-01-13 23:41:19 +01:00
|
|
|
class WithNBanksPerMemChannel(n: Int) extends Config((site, here, up) => {
|
2017-09-09 03:33:44 +02:00
|
|
|
case BankedL2Key => up(BankedL2Key, site).copy(nBanksPerChannel = n)
|
2017-01-13 23:41:19 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithNTrackersPerBank(n: Int) extends Config((site, here, up) => {
|
2017-09-09 03:33:44 +02:00
|
|
|
case BroadcastKey => up(BroadcastKey, 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-09-09 03:33:44 +02:00
|
|
|
case BroadcastKey => up(BroadcastKey, 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-11-07 22:47:56 +01:00
|
|
|
class WithIncoherentTiles extends Config((site, here, up) => {
|
|
|
|
case RocketCrossingKey => up(RocketCrossingKey, site) map { r =>
|
|
|
|
r.copy(master = r.master.copy(cork = Some(true)))
|
|
|
|
}
|
2018-01-12 21:29:27 +01:00
|
|
|
case BankedL2Key => up(BankedL2Key, site).copy(coherenceManager = { subsystem =>
|
2018-02-21 02:10:16 +01:00
|
|
|
val ww = LazyModule(new TLWidthWidget(subsystem.sbus.beatBytes)(subsystem.p))
|
2017-11-07 22:47:56 +01:00
|
|
|
(ww.node, ww.node, () => None)
|
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(
|
2018-02-21 03:28:47 +01:00
|
|
|
fpu = r.core.fpu.map(_.copy(fLen = 32)),
|
2018-02-21 00:44:30 +01:00
|
|
|
mulDiv = Some(MulDivParams(mulUnroll = 8))))
|
2017-02-09 22:59:09 +01:00
|
|
|
}
|
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,
|
2017-09-12 21:16:28 +02:00
|
|
|
generator = (p: Parameters) => {
|
|
|
|
val accumulator = LazyModule(new AccumulatorExample()(p))
|
|
|
|
accumulator}),
|
2017-06-22 21:07:09 +02:00
|
|
|
RoCCParams(
|
|
|
|
opcodes = OpcodeSet.custom1,
|
2017-09-12 21:16:28 +02:00
|
|
|
generator = (p: Parameters) => {
|
|
|
|
val translator = LazyModule(new TranslatorExample()(p))
|
|
|
|
translator},
|
2017-06-22 21:07:09 +02:00
|
|
|
nPTWPorts = 1),
|
|
|
|
RoCCParams(
|
|
|
|
opcodes = OpcodeSet.custom2,
|
2017-09-12 21:16:28 +02:00
|
|
|
generator = (p: Parameters) => {
|
|
|
|
val counter = LazyModule(new CharacterCountExample()(p))
|
|
|
|
counter
|
|
|
|
})
|
2017-06-22 21:07:09 +02:00
|
|
|
))
|
|
|
|
}
|
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-10-10 08:43:18 +02:00
|
|
|
case RocketCrossingKey => up(RocketCrossingKey, site) map { r =>
|
|
|
|
r.copy(crossingType = SynchronousCrossing())
|
|
|
|
}
|
2017-01-28 02:09:43 +01:00
|
|
|
})
|
|
|
|
|
2017-11-11 00:11:56 +01:00
|
|
|
class WithAsynchronousRocketTiles(depth: Int, sync: Int) extends Config((site, here, up) => {
|
2017-10-10 08:43:18 +02:00
|
|
|
case RocketCrossingKey => up(RocketCrossingKey, site) map { r =>
|
|
|
|
r.copy(crossingType = AsynchronousCrossing(depth, sync))
|
|
|
|
}
|
2017-01-28 02:09:43 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithRationalRocketTiles extends Config((site, here, up) => {
|
2017-10-10 08:43:18 +02:00
|
|
|
case RocketCrossingKey => up(RocketCrossingKey, site) map { r =>
|
|
|
|
r.copy(crossingType = 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) => {
|
2017-09-09 03:33:44 +02:00
|
|
|
case MemoryBusKey => up(MemoryBusKey, site).copy(beatBytes = dataBits/8)
|
2017-07-23 17:31:04 +02:00
|
|
|
case ExtIn => up(ExtIn, site).copy(beatBytes = dataBits/8)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithJtagDTM extends Config ((site, here, up) => {
|
|
|
|
case IncludeJtagDTM => true
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNBitPeripheryBus(nBits: Int) extends Config ((site, here, up) => {
|
2017-09-09 03:33:44 +02:00
|
|
|
case PeripheryBusKey => up(PeripheryBusKey, site).copy(beatBytes = nBits/8)
|
2017-07-23 17:31:04 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithoutTLMonitors extends Config ((site, here, up) => {
|
2017-09-27 09:57:18 +02:00
|
|
|
case MonitorsEnabled => false
|
2017-07-23 17:31:04 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
class WithNExtTopInterrupts(nExtInts: Int) extends Config((site, here, up) => {
|
|
|
|
case NExtTopInterrupts => nExtInts
|
|
|
|
})
|
|
|
|
|
|
|
|
class WithNMemoryChannels(n: Int) extends Config((site, here, up) => {
|
2017-09-09 03:33:44 +02:00
|
|
|
case BankedL2Key => up(BankedL2Key, site).copy(nMemoryChannels = n)
|
2017-07-23 17:31:04 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
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
|
|
|
|
})
|