2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
2016-11-16 03:27:52 +01:00
|
|
|
package coreplex
|
|
|
|
|
|
|
|
import Chisel._
|
2016-11-18 23:05:14 +01:00
|
|
|
import config._
|
2016-11-16 03:27:52 +01:00
|
|
|
import diplomacy._
|
|
|
|
import rocket._
|
2017-02-09 22:59:09 +01:00
|
|
|
import tile._
|
2017-01-17 03:24:08 +01:00
|
|
|
import uncore.tilelink2._
|
2017-03-30 04:14:04 +02:00
|
|
|
import util._
|
2016-11-16 03:27:52 +01:00
|
|
|
|
2017-01-28 02:09:43 +01:00
|
|
|
sealed trait ClockCrossing
|
|
|
|
case object Synchronous extends ClockCrossing
|
|
|
|
case object Rational extends ClockCrossing
|
|
|
|
case class Asynchronous(depth: Int, sync: Int = 2) extends ClockCrossing
|
2016-11-16 03:27:52 +01:00
|
|
|
|
2017-02-09 22:59:09 +01:00
|
|
|
case object RocketTilesKey extends Field[Seq[RocketTileParams]]
|
2017-01-28 02:09:43 +01:00
|
|
|
case object RocketCrossing extends Field[ClockCrossing]
|
2017-01-17 03:24:08 +01:00
|
|
|
|
2017-01-28 02:09:43 +01:00
|
|
|
trait HasRocketTiles extends CoreplexRISCVPlatform {
|
|
|
|
val module: HasRocketTilesModule
|
2016-11-16 03:27:52 +01:00
|
|
|
|
2017-01-28 02:09:43 +01:00
|
|
|
private val crossing = p(RocketCrossing)
|
2017-03-30 04:14:04 +02:00
|
|
|
val tileParams = p(RocketTilesKey)
|
2017-01-17 03:24:08 +01:00
|
|
|
|
2017-03-30 04:14:04 +02:00
|
|
|
// Handle interrupts to be routed directly into each tile
|
|
|
|
val localIntNodes = tileParams map { t =>
|
|
|
|
(t.core.nLocalInterrupts > 0).option(IntInputNode())
|
|
|
|
}
|
2017-03-07 01:36:03 +01:00
|
|
|
|
2017-03-30 04:14:04 +02:00
|
|
|
// Make a function for each tile that will wire it to coreplex devices and crossbars,
|
|
|
|
// according to the specified type of clock crossing.
|
|
|
|
val wiringTuple = localIntNodes.zip(tileParams).zipWithIndex
|
|
|
|
val rocketWires: Seq[HasRocketTilesBundle => Unit] = wiringTuple.map { case ((lip, c), i) =>
|
2017-02-09 22:59:09 +01:00
|
|
|
val pWithExtra = p.alterPartial {
|
|
|
|
case TileKey => c
|
|
|
|
case BuildRoCC => c.rocc
|
|
|
|
case SharedMemoryTLEdge => l1tol2.node.edgesIn(0)
|
|
|
|
}
|
|
|
|
|
2017-03-02 22:37:25 +01:00
|
|
|
val intBar = LazyModule(new IntXbar)
|
2017-03-30 17:01:11 +02:00
|
|
|
intBar.intnode := debug.intnode // debug
|
2017-03-30 04:14:04 +02:00
|
|
|
intBar.intnode := clint.intnode // msip+mtip
|
|
|
|
intBar.intnode := plic.intnode // meip
|
2017-03-02 22:37:25 +01:00
|
|
|
if (c.core.useVM) intBar.intnode := plic.intnode // seip
|
2017-03-30 04:14:04 +02:00
|
|
|
lip.foreach { intBar.intnode := _ } // lip
|
2017-03-02 22:37:25 +01:00
|
|
|
|
2017-01-28 02:09:43 +01:00
|
|
|
crossing match {
|
|
|
|
case Synchronous => {
|
2017-03-27 11:45:37 +02:00
|
|
|
val wrapper = LazyModule(new SyncRocketTile(c, i)(pWithExtra))
|
2017-02-09 22:59:09 +01:00
|
|
|
val buffer = LazyModule(new TLBuffer)
|
2017-03-21 02:52:03 +01:00
|
|
|
val fixer = LazyModule(new TLFIFOFixer)
|
2017-03-27 11:45:37 +02:00
|
|
|
buffer.node :=* wrapper.masterNode
|
2017-03-21 02:52:03 +01:00
|
|
|
fixer.node :=* buffer.node
|
|
|
|
l1tol2.node :=* fixer.node
|
2017-03-27 11:45:37 +02:00
|
|
|
wrapper.slaveNode :*= cbus.node
|
|
|
|
wrapper.intNode := intBar.intnode
|
2017-01-28 02:09:43 +01:00
|
|
|
(io: HasRocketTilesBundle) => {
|
|
|
|
// leave clock as default (simpler for hierarchical PnR)
|
2017-03-27 11:45:37 +02:00
|
|
|
wrapper.module.io.hartid := UInt(i)
|
|
|
|
wrapper.module.io.resetVector := io.resetVector
|
2017-01-28 02:09:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
case Asynchronous(depth, sync) => {
|
2017-03-02 01:47:10 +01:00
|
|
|
val wrapper = LazyModule(new AsyncRocketTile(c, i)(pWithExtra))
|
2017-02-09 22:59:09 +01:00
|
|
|
val sink = LazyModule(new TLAsyncCrossingSink(depth, sync))
|
|
|
|
val source = LazyModule(new TLAsyncCrossingSource(sync))
|
2017-03-21 02:52:03 +01:00
|
|
|
val fixer = LazyModule(new TLFIFOFixer)
|
2017-02-09 22:59:09 +01:00
|
|
|
sink.node :=* wrapper.masterNode
|
2017-03-21 02:52:03 +01:00
|
|
|
fixer.node :=* sink.node
|
|
|
|
l1tol2.node :=* fixer.node
|
2017-02-09 22:59:09 +01:00
|
|
|
wrapper.slaveNode :*= source.node
|
2017-03-02 22:37:25 +01:00
|
|
|
wrapper.intNode := intBar.intnode
|
2017-02-09 22:59:09 +01:00
|
|
|
source.node :*= cbus.node
|
2017-01-28 02:09:43 +01:00
|
|
|
(io: HasRocketTilesBundle) => {
|
|
|
|
wrapper.module.clock := io.tcrs(i).clock
|
|
|
|
wrapper.module.reset := io.tcrs(i).reset
|
|
|
|
wrapper.module.io.hartid := UInt(i)
|
|
|
|
wrapper.module.io.resetVector := io.resetVector
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case Rational => {
|
2017-03-02 01:47:10 +01:00
|
|
|
val wrapper = LazyModule(new RationalRocketTile(c, i)(pWithExtra))
|
2017-02-17 15:15:41 +01:00
|
|
|
val sink = LazyModule(new TLRationalCrossingSink(util.FastToSlow))
|
2017-02-09 22:59:09 +01:00
|
|
|
val source = LazyModule(new TLRationalCrossingSource)
|
2017-03-21 02:52:03 +01:00
|
|
|
val fixer = LazyModule(new TLFIFOFixer)
|
2017-02-09 22:59:09 +01:00
|
|
|
sink.node :=* wrapper.masterNode
|
2017-03-21 02:52:03 +01:00
|
|
|
fixer.node :=* sink.node
|
|
|
|
l1tol2.node :=* fixer.node
|
2017-02-09 22:59:09 +01:00
|
|
|
wrapper.slaveNode :*= source.node
|
2017-03-02 22:37:25 +01:00
|
|
|
wrapper.intNode := intBar.intnode
|
2017-02-09 22:59:09 +01:00
|
|
|
source.node :*= cbus.node
|
2017-01-28 02:09:43 +01:00
|
|
|
(io: HasRocketTilesBundle) => {
|
|
|
|
wrapper.module.clock := io.tcrs(i).clock
|
|
|
|
wrapper.module.reset := io.tcrs(i).reset
|
|
|
|
wrapper.module.io.hartid := UInt(i)
|
|
|
|
wrapper.module.io.resetVector := io.resetVector
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-11-19 02:15:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-28 02:09:43 +01:00
|
|
|
trait HasRocketTilesBundle extends CoreplexRISCVPlatformBundle {
|
|
|
|
val outer: HasRocketTiles
|
2017-03-30 04:14:04 +02:00
|
|
|
val local_interrupts = HeterogeneousBag(outer.localIntNodes.flatten.map(_.bundleIn))
|
2017-02-09 22:59:09 +01:00
|
|
|
val tcrs = Vec(p(RocketTilesKey).size, new Bundle {
|
2016-11-19 02:15:57 +01:00
|
|
|
val clock = Clock(INPUT)
|
|
|
|
val reset = Bool(INPUT)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2017-01-28 02:09:43 +01:00
|
|
|
trait HasRocketTilesModule extends CoreplexRISCVPlatformModule {
|
|
|
|
val outer: HasRocketTiles
|
|
|
|
val io: HasRocketTilesBundle
|
|
|
|
outer.rocketWires.foreach { _(io) }
|
2016-11-19 02:15:57 +01:00
|
|
|
}
|