2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
2016-09-22 01:54:35 +02:00
|
|
|
package coreplex
|
|
|
|
|
|
|
|
import Chisel._
|
2016-11-18 23:05:14 +01:00
|
|
|
import config._
|
2016-10-04 00:17:36 +02:00
|
|
|
import diplomacy._
|
2017-02-09 22:59:09 +01:00
|
|
|
import tile.XLen
|
|
|
|
import tile.TileInterrupts
|
2016-09-22 01:54:35 +02:00
|
|
|
import uncore.tilelink2._
|
2016-09-28 06:27:07 +02:00
|
|
|
import util._
|
2016-09-22 01:54:35 +02:00
|
|
|
|
2016-11-17 23:07:53 +01:00
|
|
|
/** Widths of various points in the SoC */
|
|
|
|
case class TLBusConfig(beatBytes: Int)
|
|
|
|
case object CBusConfig extends Field[TLBusConfig]
|
|
|
|
case object L1toL2Config extends Field[TLBusConfig]
|
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
// These parameters apply to all caches, for now
|
|
|
|
case object CacheBlockBytes extends Field[Int]
|
|
|
|
|
2016-11-18 02:26:49 +01:00
|
|
|
/** L2 Broadcast Hub configuration */
|
|
|
|
case class BroadcastConfig(
|
|
|
|
nTrackers: Int = 4,
|
|
|
|
bufferless: Boolean = false)
|
|
|
|
case object BroadcastConfig extends Field[BroadcastConfig]
|
|
|
|
|
|
|
|
/** L2 memory subsystem configuration */
|
|
|
|
case class BankedL2Config(
|
|
|
|
nMemoryChannels: Int = 1,
|
|
|
|
nBanksPerChannel: Int = 1,
|
2017-01-30 23:02:59 +01:00
|
|
|
coherenceManager: (Parameters, CoreplexNetwork) => (TLInwardNode, TLOutwardNode) = { case (q, _) =>
|
2016-12-02 02:46:52 +01:00
|
|
|
implicit val p = q
|
2016-11-18 02:26:49 +01:00
|
|
|
val BroadcastConfig(nTrackers, bufferless) = p(BroadcastConfig)
|
2016-11-23 00:12:45 +01:00
|
|
|
val bh = LazyModule(new TLBroadcast(p(CacheBlockBytes), nTrackers, bufferless))
|
2017-01-30 23:02:59 +01:00
|
|
|
val ww = LazyModule(new TLWidthWidget(p(L1toL2Config).beatBytes))
|
|
|
|
ww.node :*= bh.node
|
|
|
|
(bh.node, ww.node)
|
2016-11-18 02:26:49 +01:00
|
|
|
}) {
|
|
|
|
val nBanks = nMemoryChannels*nBanksPerChannel
|
|
|
|
}
|
|
|
|
case object BankedL2Config extends Field[BankedL2Config]
|
|
|
|
|
2016-09-22 01:54:35 +02:00
|
|
|
/** The file to read the BootROM contents from */
|
|
|
|
case object BootROMFile extends Field[String]
|
|
|
|
|
|
|
|
trait HasCoreplexParameters {
|
|
|
|
implicit val p: Parameters
|
2017-02-09 22:59:09 +01:00
|
|
|
lazy val tilesParams = p(RocketTilesKey)
|
2016-11-17 23:07:53 +01:00
|
|
|
lazy val cbusConfig = p(CBusConfig)
|
|
|
|
lazy val l1tol2Config = p(L1toL2Config)
|
2017-02-09 22:59:09 +01:00
|
|
|
lazy val nTiles = tilesParams.size
|
2016-11-18 02:26:49 +01:00
|
|
|
lazy val l2Config = p(BankedL2Config)
|
2016-09-22 01:54:35 +02:00
|
|
|
}
|
|
|
|
|
2016-10-27 07:28:40 +02:00
|
|
|
case class CoreplexParameters(implicit val p: Parameters) extends HasCoreplexParameters
|
2016-09-22 01:54:35 +02:00
|
|
|
|
2017-03-01 07:34:24 +01:00
|
|
|
abstract class BareCoreplex(implicit p: Parameters) extends LazyModule with BindingScope
|
2017-01-17 03:24:08 +01:00
|
|
|
|
2016-12-02 02:46:52 +01:00
|
|
|
abstract class BareCoreplexBundle[+L <: BareCoreplex](_outer: L) extends GenericParameterizedBundle(_outer) {
|
2016-10-29 12:30:49 +02:00
|
|
|
val outer = _outer
|
2016-12-02 02:46:52 +01:00
|
|
|
implicit val p = outer.p
|
2016-10-29 12:30:49 +02:00
|
|
|
}
|
2017-01-17 03:24:08 +01:00
|
|
|
|
2016-10-29 12:30:49 +02:00
|
|
|
abstract class BareCoreplexModule[+L <: BareCoreplex, +B <: BareCoreplexBundle[L]](_outer: L, _io: () => B) extends LazyModuleImp(_outer) {
|
|
|
|
val outer = _outer
|
|
|
|
val io = _io ()
|
2016-10-29 03:37:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-04 05:31:26 +01:00
|
|
|
abstract class BaseCoreplex(implicit p: Parameters) extends BareCoreplex
|
2016-10-29 03:37:24 +02:00
|
|
|
with CoreplexNetwork
|
2016-11-16 03:27:52 +01:00
|
|
|
with BankedL2CoherenceManagers {
|
2016-10-29 12:30:49 +02:00
|
|
|
override lazy val module = new BaseCoreplexModule(this, () => new BaseCoreplexBundle(this))
|
2016-10-27 07:28:40 +02:00
|
|
|
}
|
|
|
|
|
2016-10-29 12:30:49 +02:00
|
|
|
class BaseCoreplexBundle[+L <: BaseCoreplex](_outer: L) extends BareCoreplexBundle(_outer)
|
2016-10-29 03:37:24 +02:00
|
|
|
with CoreplexNetworkBundle
|
2016-11-04 05:31:26 +01:00
|
|
|
with BankedL2CoherenceManagersBundle
|
2016-10-27 07:28:40 +02:00
|
|
|
|
2016-10-29 12:30:49 +02:00
|
|
|
class BaseCoreplexModule[+L <: BaseCoreplex, +B <: BaseCoreplexBundle[L]](_outer: L, _io: () => B) extends BareCoreplexModule(_outer, _io)
|
2016-10-29 03:37:24 +02:00
|
|
|
with CoreplexNetworkModule
|
2016-11-04 05:31:26 +01:00
|
|
|
with BankedL2CoherenceManagersModule
|