2017-12-14 04:00:29 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
|
|
|
package freechips.rocketchip.coreplex
|
|
|
|
|
|
|
|
import Chisel._
|
2018-01-05 21:47:41 +01:00
|
|
|
import chisel3.experimental.dontTouch
|
2017-12-14 04:00:29 +01:00
|
|
|
import freechips.rocketchip.config.Parameters
|
|
|
|
import freechips.rocketchip.diplomacy._
|
|
|
|
import freechips.rocketchip.interrupts._
|
|
|
|
import freechips.rocketchip.tile.{BaseTile, TileParams, SharedMemoryTLEdge, HasExternallyDrivenTileConstants}
|
|
|
|
import freechips.rocketchip.util._
|
|
|
|
|
|
|
|
class ClockedTileInputs(implicit val p: Parameters) extends ParameterizedBundle
|
|
|
|
with HasExternallyDrivenTileConstants
|
|
|
|
with Clocked
|
|
|
|
|
|
|
|
trait HasTiles extends HasSystemBus {
|
|
|
|
val tiles: Seq[BaseTile]
|
2017-12-18 21:19:38 +01:00
|
|
|
protected def tileParams: Seq[TileParams] = tiles.map(_.tileParams)
|
2017-12-14 04:00:29 +01:00
|
|
|
def nTiles: Int = tileParams.size
|
2017-12-21 02:18:38 +01:00
|
|
|
def hartIdList: Seq[Int] = tileParams.map(_.hartId)
|
2017-12-14 04:00:29 +01:00
|
|
|
def localIntCounts: Seq[Int] = tileParams.map(_.core.nLocalInterrupts)
|
|
|
|
}
|
|
|
|
|
|
|
|
trait HasTilesBundle {
|
|
|
|
val tile_inputs: Vec[ClockedTileInputs]
|
|
|
|
}
|
|
|
|
|
|
|
|
trait HasTilesModuleImp extends LazyModuleImp
|
|
|
|
with HasTilesBundle
|
|
|
|
with HasResetVectorWire {
|
|
|
|
val outer: HasTiles
|
|
|
|
|
|
|
|
def resetVectorBits: Int = {
|
|
|
|
// Consider using the minimum over all widths, rather than enforcing homogeneity
|
2018-01-03 00:37:31 +01:00
|
|
|
val vectors = outer.tiles.map(_.module.constants.reset_vector)
|
2017-12-14 04:00:29 +01:00
|
|
|
require(vectors.tail.forall(_.getWidth == vectors.head.getWidth))
|
|
|
|
vectors.head.getWidth
|
|
|
|
}
|
|
|
|
|
2018-01-05 21:47:41 +01:00
|
|
|
val tile_inputs = dontTouch(Wire(Vec(outer.nTiles, new ClockedTileInputs()(p.alterPartial {
|
2017-12-14 04:00:29 +01:00
|
|
|
case SharedMemoryTLEdge => outer.sharedMemoryTLEdge
|
2018-01-05 21:47:41 +01:00
|
|
|
})))) // dontTouch keeps constant prop from sucking these signals into the tile
|
2017-12-14 04:00:29 +01:00
|
|
|
|
|
|
|
// Unconditionally wire up the non-diplomatic tile inputs
|
|
|
|
outer.tiles.map(_.module).zip(tile_inputs).foreach { case(tile, wire) =>
|
|
|
|
tile.clock := wire.clock
|
|
|
|
tile.reset := wire.reset
|
2018-01-03 00:37:31 +01:00
|
|
|
tile.constants.hartid := wire.hartid
|
|
|
|
tile.constants.reset_vector := wire.reset_vector
|
2017-12-14 04:00:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|