add multiclock support to Coreplex
This commit is contained in:
@ -18,7 +18,7 @@ case object GlobalAddrMap extends Field[AddrMap]
|
||||
case object ConfigString extends Field[String]
|
||||
case object NCoreplexExtClients extends Field[Int]
|
||||
/** Function for building Coreplex */
|
||||
case object BuildCoreplex extends Field[(Parameters, CoreplexConfig) => Coreplex]
|
||||
case object BuildCoreplex extends Field[(CoreplexConfig, Parameters) => BaseCoreplexModule[BaseCoreplex, BaseCoreplexBundle]]
|
||||
|
||||
/** Base Top with no Periphery */
|
||||
abstract class BaseTop(q: Parameters) extends LazyModule {
|
||||
@ -53,20 +53,22 @@ abstract class BaseTop(q: Parameters) extends LazyModule {
|
||||
peripheryBus.node := TLBuffer(TLWidthWidget(TLHintHandler(legacy.node), legacy.tlDataBytes))
|
||||
}
|
||||
|
||||
class BaseTopBundle(val p: Parameters, val c: Coreplex) extends ParameterizedBundle()(p) {
|
||||
abstract class BaseTopBundle(val p: Parameters) extends Bundle {
|
||||
val success = Bool(OUTPUT)
|
||||
}
|
||||
|
||||
abstract class BaseTopModule[+L <: BaseTop, +B <: BaseTopBundle](val p: Parameters, l: L, b: Coreplex => B) extends LazyModuleImp(l) {
|
||||
abstract class BaseTopModule[+L <: BaseTop, +B <: BaseTopBundle](
|
||||
val p: Parameters, l: L, b: => B) extends LazyModuleImp(l) {
|
||||
val outer: L = l
|
||||
val io: B = b
|
||||
|
||||
val coreplex = p(BuildCoreplex)(p, outer.c)
|
||||
val io: B = b(coreplex)
|
||||
val coreplex = p(BuildCoreplex)(outer.c, p)
|
||||
val coreplexIO = coreplex.io
|
||||
|
||||
val mmioNetwork =
|
||||
Module(new TileLinkRecursiveInterconnect(1, p(GlobalAddrMap).subMap("io:ext"))(
|
||||
p.alterPartial({ case TLId => "L2toMMIO" })))
|
||||
mmioNetwork.io.in.head <> coreplex.io.master.mmio.get
|
||||
mmioNetwork.io.in.head <> coreplexIO.master.mmio.get
|
||||
outer.legacy.module.io.legacy <> mmioNetwork.port("TL2")
|
||||
|
||||
println("Generated Address Map")
|
||||
@ -86,5 +88,5 @@ abstract class BaseTopModule[+L <: BaseTop, +B <: BaseTopBundle](val p: Paramete
|
||||
println(p(ConfigString))
|
||||
ConfigStringOutput.contents = Some(p(ConfigString))
|
||||
|
||||
io.success := coreplex.io.success
|
||||
io.success := coreplexIO.success
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class BasePlatformConfig extends Config(
|
||||
idBits = Dump("MEM_ID_BITS", site(MIFTagBits)))
|
||||
}
|
||||
case BuildCoreplex =>
|
||||
(p: Parameters, c: CoreplexConfig) => Module(new DefaultCoreplex(p, c))
|
||||
(c: CoreplexConfig, p: Parameters) => uncore.tilelink2.LazyModule(new DefaultCoreplex(c)(p)).module
|
||||
case NExtTopInterrupts => 2
|
||||
// Note that PLIC asserts that this is > 0.
|
||||
case AsyncDebugBus => false
|
||||
|
@ -4,33 +4,66 @@ package rocketchip
|
||||
|
||||
import Chisel._
|
||||
import cde.{Parameters, Field}
|
||||
import coreplex.Coreplex
|
||||
import junctions._
|
||||
import coreplex._
|
||||
import rocketchip._
|
||||
|
||||
/** Example Top with Periphery */
|
||||
class ExampleTop(q: Parameters) extends BaseTop(q)
|
||||
with PeripheryBootROM with PeripheryDebug with PeripheryExtInterrupts with PeripheryCoreplexLocalInterrupter
|
||||
with PeripheryMasterMem with PeripheryMasterMMIO with PeripherySlave {
|
||||
override lazy val module = Module(new ExampleTopModule(p, this, new ExampleTopBundle(p, _)))
|
||||
with PeripheryBootROM
|
||||
with PeripheryDebug
|
||||
with PeripheryExtInterrupts
|
||||
with PeripheryCoreplexLocalInterrupter
|
||||
with PeripheryMasterMem
|
||||
with PeripheryMasterMMIO
|
||||
with PeripherySlave {
|
||||
override lazy val module = Module(new ExampleTopModule(p, this, new ExampleTopBundle(p)))
|
||||
}
|
||||
|
||||
class ExampleTopBundle(p: Parameters, c: Coreplex) extends BaseTopBundle(p, c)
|
||||
with PeripheryBootROMBundle with PeripheryDebugBundle with PeripheryExtInterruptsBundle with PeripheryCoreplexLocalInterrupterBundle
|
||||
with PeripheryMasterMemBundle with PeripheryMasterMMIOBundle with PeripherySlaveBundle
|
||||
class ExampleTopBundle(p: Parameters) extends BaseTopBundle(p)
|
||||
with PeripheryBootROMBundle
|
||||
with PeripheryDebugBundle
|
||||
with PeripheryExtInterruptsBundle
|
||||
with PeripheryCoreplexLocalInterrupterBundle
|
||||
with PeripheryMasterMemBundle
|
||||
with PeripheryMasterMMIOBundle
|
||||
with PeripherySlaveBundle
|
||||
|
||||
class ExampleTopModule[+L <: ExampleTop, +B <: ExampleTopBundle](p: Parameters, l: L, b: Coreplex => B) extends BaseTopModule(p, l, b)
|
||||
with PeripheryBootROMModule with PeripheryDebugModule with PeripheryExtInterruptsModule with PeripheryCoreplexLocalInterrupterModule
|
||||
with PeripheryMasterMemModule with PeripheryMasterMMIOModule with PeripherySlaveModule
|
||||
class ExampleTopModule[+L <: ExampleTop, +B <: ExampleTopBundle](p: Parameters, l: L, b: => B) extends BaseTopModule(p, l, b)
|
||||
with PeripheryBootROMModule
|
||||
with PeripheryDebugModule
|
||||
with PeripheryExtInterruptsModule
|
||||
with PeripheryCoreplexLocalInterrupterModule
|
||||
with PeripheryMasterMemModule
|
||||
with PeripheryMasterMMIOModule
|
||||
with PeripherySlaveModule
|
||||
with HardwiredResetVector
|
||||
|
||||
/** Example Top with TestRAM */
|
||||
class ExampleTopWithTestRAM(q: Parameters) extends ExampleTop(q)
|
||||
with PeripheryTestRAM {
|
||||
override lazy val module = Module(new ExampleTopWithTestRAMModule(p, this, new ExampleTopWithTestRAMBundle(p, _)))
|
||||
override lazy val module = Module(new ExampleTopWithTestRAMModule(p, this, new ExampleTopWithTestRAMBundle(p)))
|
||||
}
|
||||
|
||||
class ExampleTopWithTestRAMBundle(p: Parameters, c: Coreplex) extends ExampleTopBundle(p, c)
|
||||
class ExampleTopWithTestRAMBundle(p: Parameters) extends ExampleTopBundle(p)
|
||||
with PeripheryTestRAMBundle
|
||||
|
||||
class ExampleTopWithTestRAMModule[+L <: ExampleTopWithTestRAM, +B <: ExampleTopWithTestRAMBundle](p: Parameters, l: L, b: Coreplex => B) extends ExampleTopModule(p, l, b)
|
||||
class ExampleTopWithTestRAMModule[+L <: ExampleTopWithTestRAM, +B <: ExampleTopWithTestRAMBundle](p: Parameters, l: L, b: => B) extends ExampleTopModule(p, l, b)
|
||||
with PeripheryTestRAMModule
|
||||
|
||||
/** Example Top with Multi Clock */
|
||||
class ExampleMultiClockTop(q: Parameters) extends ExampleTop(q)
|
||||
with PeripheryTestRAM {
|
||||
override lazy val module = Module(new ExampleMultiClockTopModule(p, this, new ExampleMultiClockTopBundle(p)))
|
||||
}
|
||||
|
||||
class ExampleMultiClockTopBundle(p: Parameters) extends ExampleTopBundle(p)
|
||||
|
||||
class ExampleMultiClockTopModule[+L <: ExampleMultiClockTop, +B <: ExampleMultiClockTopBundle](p: Parameters, l: L, b: => B) extends ExampleTopModule(p, l, b) {
|
||||
val multiClockCoreplexIO = coreplexIO.asInstanceOf[MultiClockCoreplexBundle]
|
||||
|
||||
multiClockCoreplexIO.trcs foreach { trc =>
|
||||
trc.clock := clock
|
||||
trc.reset := reset
|
||||
}
|
||||
}
|
||||
|
@ -101,16 +101,16 @@ trait PeripheryDebugModule {
|
||||
implicit val p: Parameters
|
||||
val outer: PeripheryDebug
|
||||
val io: PeripheryDebugBundle
|
||||
val coreplex: Coreplex
|
||||
val coreplexIO: BaseCoreplexBundle
|
||||
|
||||
if (p(IncludeJtagDTM)) {
|
||||
// JtagDTMWithSync is a wrapper which
|
||||
// handles the synchronization as well.
|
||||
val dtm = Module (new JtagDTMWithSync()(p))
|
||||
dtm.io.jtag <> io.jtag.get
|
||||
coreplex.io.debug <> dtm.io.debug
|
||||
coreplexIO.debug <> dtm.io.debug
|
||||
} else {
|
||||
coreplex.io.debug <>
|
||||
coreplexIO.debug <>
|
||||
(if (p(AsyncDebugBus)) AsyncDebugBusFrom(io.debug_clk.get, io.debug_rst.get, io.debug.get)
|
||||
else io.debug.get)
|
||||
}
|
||||
@ -134,12 +134,12 @@ trait PeripheryExtInterruptsModule {
|
||||
implicit val p: Parameters
|
||||
val outer: PeripheryExtInterrupts
|
||||
val io: PeripheryExtInterruptsBundle
|
||||
val coreplex: Coreplex
|
||||
val coreplexIO: BaseCoreplexBundle
|
||||
|
||||
{
|
||||
val r = outer.pInterrupts.range("ext")
|
||||
((r._1 until r._2) zipWithIndex) foreach { case (c, i) =>
|
||||
coreplex.io.interrupts(c) := io.interrupts(i)
|
||||
coreplexIO.interrupts(c) := io.interrupts(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,10 +163,10 @@ trait PeripheryMasterMemModule extends HasPeripheryParameters {
|
||||
implicit val p: Parameters
|
||||
val outer: PeripheryMasterMem
|
||||
val io: PeripheryMasterMemBundle
|
||||
val coreplex: Coreplex
|
||||
val coreplexIO: BaseCoreplexBundle
|
||||
|
||||
// Abuse the fact that zip takes the shorter of the two lists
|
||||
((io.mem_axi zip coreplex.io.master.mem) zipWithIndex) foreach { case ((axi, mem), idx) =>
|
||||
((io.mem_axi zip coreplexIO.master.mem) zipWithIndex) foreach { case ((axi, mem), idx) =>
|
||||
val axi_sync = PeripheryUtils.convertTLtoAXI(mem)(outermostParams)
|
||||
axi_sync.ar.bits.cache := CACHE_NORMAL_NOCACHE_BUF
|
||||
axi_sync.aw.bits.cache := CACHE_NORMAL_NOCACHE_BUF
|
||||
@ -176,11 +176,11 @@ trait PeripheryMasterMemModule extends HasPeripheryParameters {
|
||||
)
|
||||
}
|
||||
|
||||
(io.mem_ahb zip coreplex.io.master.mem) foreach { case (ahb, mem) =>
|
||||
(io.mem_ahb zip coreplexIO.master.mem) foreach { case (ahb, mem) =>
|
||||
ahb <> PeripheryUtils.convertTLtoAHB(mem, atomics = false)(outermostParams)
|
||||
}
|
||||
|
||||
(io.mem_tl zip coreplex.io.master.mem) foreach { case (tl, mem) =>
|
||||
(io.mem_tl zip coreplexIO.master.mem) foreach { case (tl, mem) =>
|
||||
tl <> TileLinkEnqueuer(mem, 2)(outermostParams)
|
||||
}
|
||||
}
|
||||
@ -258,7 +258,7 @@ trait PeripherySlaveModule extends HasPeripheryParameters {
|
||||
implicit val p: Parameters
|
||||
val outer: PeripherySlave
|
||||
val io: PeripherySlaveBundle
|
||||
val coreplex: Coreplex
|
||||
val coreplexIO: BaseCoreplexBundle
|
||||
|
||||
if (p(NExtBusAXIChannels) > 0) {
|
||||
val arb = Module(new NastiArbiter(p(NExtBusAXIChannels)))
|
||||
@ -273,7 +273,7 @@ trait PeripherySlaveModule extends HasPeripheryParameters {
|
||||
|
||||
val r = outer.pBusMasters.range("ext")
|
||||
require(r._2 - r._1 == 1, "RangeManager should return 1 slot")
|
||||
coreplex.io.slave(r._1) <> conv.io.tl
|
||||
coreplexIO.slave(r._1) <> conv.io.tl
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,10 +299,10 @@ trait PeripheryCoreplexLocalInterrupterModule extends HasPeripheryParameters {
|
||||
implicit val p: Parameters
|
||||
val outer: PeripheryCoreplexLocalInterrupter
|
||||
val io: PeripheryCoreplexLocalInterrupterBundle
|
||||
val coreplex: Coreplex
|
||||
val coreplexIO: BaseCoreplexBundle
|
||||
|
||||
outer.clint.module.io.rtcTick := Counter(p(RTCPeriod)).inc()
|
||||
coreplex.io.clint <> outer.clint.module.io.tiles
|
||||
coreplexIO.clint <> outer.clint.module.io.tiles
|
||||
}
|
||||
|
||||
/////
|
||||
@ -371,6 +371,6 @@ trait PeripheryTestBusMasterModule {
|
||||
/////
|
||||
|
||||
trait HardwiredResetVector {
|
||||
val coreplex: Coreplex
|
||||
coreplex.io.resetVector := UInt(0x1000) // boot ROM
|
||||
val coreplexIO: BaseCoreplexBundle
|
||||
coreplexIO.resetVector := UInt(0x1000) // boot ROM
|
||||
}
|
||||
|
Reference in New Issue
Block a user