2017-02-09 22:59:09 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
|
|
|
package tile
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import config._
|
|
|
|
import diplomacy._
|
|
|
|
import rocket._
|
|
|
|
import uncore.tilelink2._
|
|
|
|
import util._
|
|
|
|
|
|
|
|
case object SharedMemoryTLEdge extends Field[TLEdgeOut]
|
|
|
|
case object TileKey extends Field[TileParams]
|
|
|
|
|
|
|
|
trait TileParams {
|
|
|
|
val core: CoreParams
|
|
|
|
val icache: Option[ICacheParams]
|
|
|
|
val dcache: Option[DCacheParams]
|
|
|
|
val rocc: Seq[RoCCParams]
|
|
|
|
val btb: Option[BTBParams]
|
|
|
|
}
|
|
|
|
|
|
|
|
trait HasTileParameters {
|
|
|
|
implicit val p: Parameters
|
|
|
|
val tileParams: TileParams = p(TileKey)
|
|
|
|
|
|
|
|
val usingVM = tileParams.core.useVM
|
|
|
|
val usingUser = tileParams.core.useUser || usingVM
|
|
|
|
val usingDebug = tileParams.core.useDebug
|
|
|
|
val usingRoCC = !tileParams.rocc.isEmpty
|
|
|
|
val usingBTB = tileParams.btb.isDefined && tileParams.btb.get.nEntries > 0
|
|
|
|
val usingPTW = usingVM
|
2017-03-07 06:35:45 +01:00
|
|
|
val usingDataScratchpad = tileParams.dcache.flatMap(_.scratch).isDefined
|
2017-04-27 05:11:43 +02:00
|
|
|
val hartIdLen = log2Up(p(uncore.devices.NTiles))
|
2017-02-09 22:59:09 +01:00
|
|
|
|
|
|
|
def dcacheArbPorts = 1 + usingVM.toInt + usingDataScratchpad.toInt + tileParams.rocc.size
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class BareTile(implicit p: Parameters) extends LazyModule
|
|
|
|
|
|
|
|
abstract class BareTileBundle[+L <: BareTile](_outer: L) extends GenericParameterizedBundle(_outer) {
|
|
|
|
val outer = _outer
|
|
|
|
implicit val p = outer.p
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class BareTileModule[+L <: BareTile, +B <: BareTileBundle[L]](_outer: L, _io: () => B) extends LazyModuleImp(_outer) {
|
|
|
|
val outer = _outer
|
|
|
|
val io = _io ()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Uses TileLink master port to connect caches and accelerators to the coreplex
|
|
|
|
trait HasTileLinkMasterPort extends HasTileParameters {
|
|
|
|
implicit val p: Parameters
|
|
|
|
val module: HasTileLinkMasterPortModule
|
|
|
|
val masterNode = TLOutputNode()
|
|
|
|
}
|
|
|
|
|
|
|
|
trait HasTileLinkMasterPortBundle {
|
|
|
|
val outer: HasTileLinkMasterPort
|
|
|
|
val master = outer.masterNode.bundleOut
|
|
|
|
}
|
|
|
|
|
|
|
|
trait HasTileLinkMasterPortModule {
|
|
|
|
val outer: HasTileLinkMasterPort
|
|
|
|
val io: HasTileLinkMasterPortBundle
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class BaseTile(tileParams: TileParams)(implicit p: Parameters) extends BareTile
|
2017-03-30 04:14:04 +02:00
|
|
|
with HasTileLinkMasterPort
|
|
|
|
with HasExternalInterrupts {
|
2017-02-09 22:59:09 +01:00
|
|
|
override lazy val module = new BaseTileModule(this, () => new BaseTileBundle(this))
|
|
|
|
}
|
|
|
|
|
|
|
|
class BaseTileBundle[+L <: BaseTile](_outer: L) extends BareTileBundle(_outer)
|
2017-04-27 05:11:43 +02:00
|
|
|
with HasTileParameters
|
2017-03-30 04:14:04 +02:00
|
|
|
with HasTileLinkMasterPortBundle
|
|
|
|
with HasExternalInterruptsBundle {
|
2017-04-27 05:11:43 +02:00
|
|
|
val hartid = UInt(INPUT, hartIdLen)
|
2017-02-09 22:59:09 +01:00
|
|
|
val resetVector = UInt(INPUT, p(XLen))
|
|
|
|
}
|
|
|
|
|
|
|
|
class BaseTileModule[+L <: BaseTile, +B <: BaseTileBundle[L]](_outer: L, _io: () => B) extends BareTileModule(_outer, _io)
|
|
|
|
with HasTileLinkMasterPortModule
|
2017-03-30 04:14:04 +02:00
|
|
|
with HasExternalInterruptsModule
|