Bump rocket-chip + submodules for new clustered-tile API

This commit is contained in:
Jerry Zhao
2023-10-17 14:38:28 -07:00
parent 2b16b9bad1
commit aa057239f2
33 changed files with 116 additions and 152 deletions

View File

@@ -5,7 +5,6 @@ import chisel3._
import scala.collection.mutable.{ArrayBuffer} import scala.collection.mutable.{ArrayBuffer}
import freechips.rocketchip.prci.{ClockGroupIdentityNode, ClockSinkParameters, ClockSinkNode, ClockGroup} import freechips.rocketchip.prci.{ClockGroupIdentityNode, ClockSinkParameters, ClockSinkNode, ClockGroup}
import freechips.rocketchip.subsystem.{BaseSubsystem, SubsystemDriveAsyncClockGroupsKey}
import org.chipsalliance.cde.config.{Parameters, Field} import org.chipsalliance.cde.config.{Parameters, Field}
import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, LazyRawModuleImp, LazyModuleImpLike, BindingScope} import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, LazyRawModuleImp, LazyModuleImpLike, BindingScope}
import freechips.rocketchip.util.{ResetCatchAndSync} import freechips.rocketchip.util.{ResetCatchAndSync}

View File

@@ -40,7 +40,6 @@ class DigitalTop(implicit p: Parameters) extends ChipyardSystem
} }
class DigitalTopModule[+L <: DigitalTop](l: L) extends ChipyardSystemModule(l) class DigitalTopModule[+L <: DigitalTop](l: L) extends ChipyardSystemModule(l)
with testchipip.CanHaveTraceIOModuleImp
with sifive.blocks.devices.i2c.HasPeripheryI2CModuleImp with sifive.blocks.devices.i2c.HasPeripheryI2CModuleImp
with sifive.blocks.devices.pwm.HasPeripheryPWMModuleImp with sifive.blocks.devices.pwm.HasPeripheryPWMModuleImp
with sifive.blocks.devices.uart.HasPeripheryUARTModuleImp with sifive.blocks.devices.uart.HasPeripheryUARTModuleImp

View File

@@ -77,14 +77,15 @@ case class SpikeTileAttachParams(
} }
case class SpikeTileParams( case class SpikeTileParams(
hartId: Int = 0, tileId: Int = 0,
val core: SpikeCoreParams = SpikeCoreParams(), val core: SpikeCoreParams = SpikeCoreParams(),
icacheParams: ICacheParams = ICacheParams(nWays = 32), icacheParams: ICacheParams = ICacheParams(nWays = 32),
dcacheParams: DCacheParams = DCacheParams(nWays = 32), dcacheParams: DCacheParams = DCacheParams(nWays = 32),
tcmParams: Option[MasterPortParams] = None // tightly coupled memory tcmParams: Option[MasterPortParams] = None // tightly coupled memory
) extends InstantiableTileParams[SpikeTile] ) extends InstantiableTileParams[SpikeTile]
{ {
val name = Some("spike_tile") val baseName = "spike_tile"
val uniqueName = s"${baseName}_$tileId"
val beuAddr = None val beuAddr = None
val blockerCtrlAddr = None val blockerCtrlAddr = None
val btb = None val btb = None
@@ -92,7 +93,7 @@ case class SpikeTileParams(
val dcache = Some(dcacheParams) val dcache = Some(dcacheParams)
val icache = Some(icacheParams) val icache = Some(icacheParams)
val clockSinkParams = ClockSinkParameters() val clockSinkParams = ClockSinkParameters()
def instantiate(crossing: TileCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters): SpikeTile = { def instantiate(crossing: HierarchicalElementCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters): SpikeTile = {
new SpikeTile(this, crossing, lookup) new SpikeTile(this, crossing, lookup)
} }
} }
@@ -106,11 +107,11 @@ class SpikeTile(
with SourcesExternalNotifications with SourcesExternalNotifications
{ {
// Private constructor ensures altered LazyModule.p is used implicitly // Private constructor ensures altered LazyModule.p is used implicitly
def this(params: SpikeTileParams, crossing: TileCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters) = def this(params: SpikeTileParams, crossing: HierarchicalElementCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters) =
this(params, crossing.crossingType, lookup, p) this(params, crossing.crossingType, lookup, p)
// Required TileLink nodes // Required TileLink nodes
val intOutwardNode = IntIdentityNode() val intOutwardNode = Some(IntIdentityNode())
val masterNode = visibilityNode val masterNode = visibilityNode
val slaveNode = TLIdentityNode() val slaveNode = TLIdentityNode()
@@ -129,21 +130,21 @@ class SpikeTile(
} }
ResourceBinding { ResourceBinding {
Resource(cpuDevice, "reg").bind(ResourceAddress(hartId)) Resource(cpuDevice, "reg").bind(ResourceAddress(tileId))
} }
val icacheNode = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1( val icacheNode = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1(
sourceId = IdRange(0, 1), sourceId = IdRange(0, 1),
name = s"Core ${staticIdForMetadataUseOnly} ICache"))))) name = s"Core ${tileId} ICache")))))
val dcacheNode = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1( val dcacheNode = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1(
name = s"Core ${staticIdForMetadataUseOnly} DCache", name = s"Core ${tileId} DCache",
sourceId = IdRange(0, tileParams.dcache.get.nMSHRs), sourceId = IdRange(0, tileParams.dcache.get.nMSHRs),
supportsProbe = TransferSizes(p(CacheBlockBytes), p(CacheBlockBytes))))))) supportsProbe = TransferSizes(p(CacheBlockBytes), p(CacheBlockBytes)))))))
val mmioNode = TLClientNode((Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1( val mmioNode = TLClientNode((Seq(TLMasterPortParameters.v1(Seq(TLMasterParameters.v1(
name = s"Core ${staticIdForMetadataUseOnly} MMIO", name = s"Core ${tileId} MMIO",
sourceId = IdRange(0, 1), sourceId = IdRange(0, 1),
requestFifo = true)))))) requestFifo = true))))))
@@ -313,7 +314,7 @@ class SpikeBlackBox(
} }
class SpikeTileModuleImp(outer: SpikeTile) extends BaseTileModuleImp(outer) { class SpikeTileModuleImp(outer: SpikeTile) extends BaseTileModuleImp(outer) {
val tileParams = outer.tileParams
// We create a bundle here and decode the interrupt. // We create a bundle here and decode the interrupt.
val int_bundle = Wire(new TileInterrupts()) val int_bundle = Wire(new TileInterrupts())
outer.decodeCoreInterrupts(int_bundle) outer.decodeCoreInterrupts(int_bundle)
@@ -337,7 +338,7 @@ class SpikeTileModuleImp(outer: SpikeTile) extends BaseTileModuleImp(outer) {
// then the DTM-based bringup with SimDTM will be used. This isn't required to be // then the DTM-based bringup with SimDTM will be used. This isn't required to be
// true, but it usually is // true, but it usually is
val useDTM = p(ExportDebug).protocols.contains(DMI) val useDTM = p(ExportDebug).protocols.contains(DMI)
val spike = Module(new SpikeBlackBox(hartId, isaDTS, tileParams.core.nPMPs, val spike = Module(new SpikeBlackBox(outer.tileId, outer.isaDTS, tileParams.core.nPMPs,
tileParams.icache.get.nSets, tileParams.icache.get.nWays, tileParams.icache.get.nSets, tileParams.icache.get.nWays,
tileParams.dcache.get.nSets, tileParams.dcache.get.nWays, tileParams.dcache.get.nSets, tileParams.dcache.get.nWays,
tileParams.dcache.get.nMSHRs, tileParams.dcache.get.nMSHRs,
@@ -467,19 +468,21 @@ class SpikeTileModuleImp(outer: SpikeTile) extends BaseTileModuleImp(outer) {
} }
} }
class WithNSpikeCores(n: Int = 1, tileParams: SpikeTileParams = SpikeTileParams(), class WithNSpikeCores(n: Int = 1, tileParams: SpikeTileParams = SpikeTileParams()
overrideIdOffset: Option[Int] = None) extends Config((site, here, up) => { ) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => { case TilesLocated(InSubsystem) => {
// Calculate the next available hart ID (since hart ID cannot be duplicated) // Calculate the next available hart ID (since hart ID cannot be duplicated)
val prev = up(TilesLocated(InSubsystem), site) val prev = up(TilesLocated(InSubsystem), site)
val idOffset = overrideIdOffset.getOrElse(prev.size) val idOffset = up(NumTiles)
// Create TileAttachParams for every core to be instantiated // Create TileAttachParams for every core to be instantiated
(0 until n).map { i => (0 until n).map { i =>
SpikeTileAttachParams( SpikeTileAttachParams(
tileParams = tileParams.copy(hartId = i + idOffset) tileParams = tileParams.copy(tileId = i + idOffset)
) )
} ++ prev } ++ prev
} }
case NumTiles => up(NumTiles) + n
}) })
class WithSpikeTCM extends Config((site, here, up) => { class WithSpikeTCM extends Config((site, here, up) => {
@@ -492,5 +495,5 @@ class WithSpikeTCM extends Config((site, here, up) => {
))) )))
} }
case ExtMem => None case ExtMem => None
case BankedL2Key => up(BankedL2Key).copy(nBanks = 0) case SubsystemBankedCoherenceKey => up(SubsystemBankedCoherenceKey).copy(nBanks = 0)
}) })

View File

@@ -71,18 +71,24 @@ trait CanHaveChosenInDTS { this: BaseSubsystem =>
} }
class ChipyardSubsystem(implicit p: Parameters) extends BaseSubsystem class ChipyardSubsystem(implicit p: Parameters) extends BaseSubsystem
with HasTiles with InstantiatesHierarchicalElements
with HasPeripheryDebug with HasTileNotificationSinks
with CanHaveHTIF with HasTileInputConstants
with CanHaveChosenInDTS with CanHavePeripheryCLINT
with CanHavePeripheryPLIC
with HasPeripheryDebug
with HasHierarchicalElementsRootContext
with HasHierarchicalElements
with CanHaveHTIF
with CanHaveChosenInDTS
{ {
def coreMonitorBundles = tiles.map { def coreMonitorBundles = totalTiles.values.map {
case r: RocketTile => r.module.core.rocketImpl.coreMonitorBundle case r: RocketTile => r.module.core.rocketImpl.coreMonitorBundle
case b: BoomTile => b.module.core.coreMonitorBundle case b: BoomTile => b.module.core.coreMonitorBundle
}.toList }.toList
// No-tile configs have to be handled specially. // No-tile configs have to be handled specially.
if (tiles.size == 0) { if (totalTiles.size == 0) {
// no PLIC, so sink interrupts to nowhere // no PLIC, so sink interrupts to nowhere
require(!p(PLICKey).isDefined) require(!p(PLICKey).isDefined)
val intNexus = IntNexusNode(sourceFn = x => x.head, sinkFn = x => x.head) val intNexus = IntNexusNode(sourceFn = x => x.head, sinkFn = x => x.head)
@@ -96,10 +102,6 @@ class ChipyardSubsystem(implicit p: Parameters) extends BaseSubsystem
tileHaltXbarNode := IntSourceNode(IntSourcePortSimple()) tileHaltXbarNode := IntSourceNode(IntSourcePortSimple())
tileWFIXbarNode := IntSourceNode(IntSourcePortSimple()) tileWFIXbarNode := IntSourceNode(IntSourcePortSimple())
tileCeaseXbarNode := IntSourceNode(IntSourcePortSimple()) tileCeaseXbarNode := IntSourceNode(IntSourcePortSimple())
// Sink reset vectors to nowhere
val resetVectorSink = BundleBridgeSink[UInt](Some(() => UInt(28.W)))
resetVectorSink := tileResetVectorNode
} }
// Relying on [[TLBusWrapperConnection]].driveClockFromMaster for // Relying on [[TLBusWrapperConnection]].driveClockFromMaster for
@@ -107,7 +109,7 @@ class ChipyardSubsystem(implicit p: Parameters) extends BaseSubsystem
// ClockGroup. This makes it impossible to determine which clocks are driven // ClockGroup. This makes it impossible to determine which clocks are driven
// by which bus based on the member names, which is problematic when there is // by which bus based on the member names, which is problematic when there is
// a rational crossing between two buses. Instead, provide all bus clocks // a rational crossing between two buses. Instead, provide all bus clocks
// directly from the asyncClockGroupsNode in the subsystem to ensure bus // directly from the allClockGroupsNode in the subsystem to ensure bus
// names are always preserved in the top-level clock names. // names are always preserved in the top-level clock names.
// //
// For example, using a RationalCrossing between the Sbus and Cbus, and // For example, using a RationalCrossing between the Sbus and Cbus, and
@@ -116,12 +118,12 @@ class ChipyardSubsystem(implicit p: Parameters) extends BaseSubsystem
// Conversly, if an async crossing is used, they instead receive names of the // Conversly, if an async crossing is used, they instead receive names of the
// form "subsystem_cbus_[0-9]*". The assignment below provides the latter names in all cases. // form "subsystem_cbus_[0-9]*". The assignment below provides the latter names in all cases.
Seq(PBUS, FBUS, MBUS, CBUS).foreach { loc => Seq(PBUS, FBUS, MBUS, CBUS).foreach { loc =>
tlBusWrapperLocationMap.lift(loc).foreach { _.clockGroupNode := asyncClockGroupsNode } tlBusWrapperLocationMap.lift(loc).foreach { _.clockGroupNode := allClockGroupsNode }
} }
override lazy val module = new ChipyardSubsystemModuleImp(this) override lazy val module = new ChipyardSubsystemModuleImp(this)
} }
class ChipyardSubsystemModuleImp[+L <: ChipyardSubsystem](_outer: L) extends BaseSubsystemModuleImp(_outer) class ChipyardSubsystemModuleImp[+L <: ChipyardSubsystem](_outer: L) extends BaseSubsystemModuleImp(_outer)
with HasTilesModuleImp with HasHierarchicalElementsRootContextModuleImp
{ {
} }

View File

@@ -32,13 +32,6 @@ class ChipyardSystem(implicit p: Parameters) extends ChipyardSubsystem
val bootROM = p(BootROMLocated(location)).map { BootROM.attach(_, this, CBUS) } val bootROM = p(BootROMLocated(location)).map { BootROM.attach(_, this, CBUS) }
val maskROMs = p(MaskROMLocated(location)).map { MaskROM.attach(_, this, CBUS) } val maskROMs = p(MaskROMLocated(location)).map { MaskROM.attach(_, this, CBUS) }
// If there is no bootrom, the tile reset vector bundle will be tied to zero
if (bootROM.isEmpty) {
val fakeResetVectorSourceNode = BundleBridgeSource[UInt]()
InModuleBody { fakeResetVectorSourceNode.bundle := 0.U }
tileResetVectorNexusNode := fakeResetVectorSourceNode
}
override lazy val module = new ChipyardSystemModule(this) override lazy val module = new ChipyardSystemModule(this)
} }

View File

@@ -65,7 +65,7 @@ class TestSuiteHelper
*/ */
def addGenericTestSuites(tiles: Seq[TileParams])(implicit p: Parameters) = { def addGenericTestSuites(tiles: Seq[TileParams])(implicit p: Parameters) = {
val xlen = p(XLen) val xlen = p(XLen)
tiles.find(_.hartId == 0).map { tileParams => tiles.find(_.tileId == 0).map { tileParams =>
val coreParams = tileParams.core val coreParams = tileParams.core
val vm = coreParams.useVM val vm = coreParams.useVM
val env = if (vm) List("p","v") else List("p") val env = if (vm) List("p","v") else List("p")

View File

@@ -18,16 +18,6 @@ class WithPLLSelectorDividerClockGenerator extends OverrideLazyIOBinder({
(system: HasChipyardPRCI) => { (system: HasChipyardPRCI) => {
// Connect the implicit clock // Connect the implicit clock
implicit val p = GetSystemParameters(system) implicit val p = GetSystemParameters(system)
val implicitClockSinkNode = ClockSinkNode(Seq(ClockSinkParameters(name = Some("implicit_clock"))))
system.connectImplicitClockSinkNode(implicitClockSinkNode)
InModuleBody {
val implicit_clock = implicitClockSinkNode.in.head._1.clock
val implicit_reset = implicitClockSinkNode.in.head._1.reset
system.asInstanceOf[BaseSubsystem].module match { case l: LazyModuleImp => {
l.clock := implicit_clock
l.reset := implicit_reset
}}
}
val tlbus = system.asInstanceOf[BaseSubsystem].locateTLBusWrapper(system.prciParams.slaveWhere) val tlbus = system.asInstanceOf[BaseSubsystem].locateTLBusWrapper(system.prciParams.slaveWhere)
val baseAddress = system.prciParams.baseAddress val baseAddress = system.prciParams.baseAddress
val clockDivider = system.prci_ctrl_domain { LazyModule(new TLClockDivider (baseAddress + 0x20000, tlbus.beatBytes)) } val clockDivider = system.prci_ctrl_domain { LazyModule(new TLClockDivider (baseAddress + 0x20000, tlbus.beatBytes)) }
@@ -38,7 +28,7 @@ class WithPLLSelectorDividerClockGenerator extends OverrideLazyIOBinder({
clockSelector.tlNode := system.prci_ctrl_domain { TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := system.prci_ctrl_bus.get } clockSelector.tlNode := system.prci_ctrl_domain { TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := system.prci_ctrl_bus.get }
pllCtrl.tlNode := system.prci_ctrl_domain { TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := system.prci_ctrl_bus.get } pllCtrl.tlNode := system.prci_ctrl_domain { TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := system.prci_ctrl_bus.get }
system.allClockGroupsNode := clockDivider.clockNode := clockSelector.clockNode system.chiptopClockGroupsNode := clockDivider.clockNode := clockSelector.clockNode
// Connect all other requested clocks // Connect all other requested clocks
val slowClockSource = ClockSourceNode(Seq(ClockSourceParameters())) val slowClockSource = ClockSourceNode(Seq(ClockSourceParameters()))
@@ -83,23 +73,12 @@ class WithPLLSelectorDividerClockGenerator extends OverrideLazyIOBinder({
// This passes all clocks through to the TestHarness // This passes all clocks through to the TestHarness
class WithPassthroughClockGenerator extends OverrideLazyIOBinder({ class WithPassthroughClockGenerator extends OverrideLazyIOBinder({
(system: HasChipyardPRCI) => { (system: HasChipyardPRCI) => {
// Connect the implicit clock
implicit val p = GetSystemParameters(system) implicit val p = GetSystemParameters(system)
val implicitClockSinkNode = ClockSinkNode(Seq(ClockSinkParameters(name = Some("implicit_clock"))))
system.connectImplicitClockSinkNode(implicitClockSinkNode)
InModuleBody {
val implicit_clock = implicitClockSinkNode.in.head._1.clock
val implicit_reset = implicitClockSinkNode.in.head._1.reset
system.asInstanceOf[BaseSubsystem].module match { case l: LazyModuleImp => {
l.clock := implicit_clock
l.reset := implicit_reset
}}
}
// This aggregate node should do nothing // This aggregate node should do nothing
val clockGroupAggNode = ClockGroupAggregateNode("fake") val clockGroupAggNode = ClockGroupAggregateNode("fake")
val clockGroupsSourceNode = ClockGroupSourceNode(Seq(ClockGroupSourceParameters())) val clockGroupsSourceNode = ClockGroupSourceNode(Seq(ClockGroupSourceParameters()))
system.allClockGroupsNode := clockGroupAggNode := clockGroupsSourceNode system.chiptopClockGroupsNode := clockGroupAggNode := clockGroupsSourceNode
InModuleBody { InModuleBody {
val reset_io = IO(Input(AsyncReset())) val reset_io = IO(Input(AsyncReset()))

View File

@@ -29,8 +29,8 @@ case class ChipyardPRCIControlParams(
case object ChipyardPRCIControlKey extends Field[ChipyardPRCIControlParams](ChipyardPRCIControlParams()) case object ChipyardPRCIControlKey extends Field[ChipyardPRCIControlParams](ChipyardPRCIControlParams())
trait HasChipyardPRCI { this: BaseSubsystem with InstantiatesTiles => trait HasChipyardPRCI { this: BaseSubsystem with InstantiatesHierarchicalElementss =>
require(p(SubsystemDriveAsyncClockGroupsKey).isEmpty, "Subsystem asyncClockGroups must be undriven") require(!p(SubsystemDriveDriveClockGroupsFromIO), "Subsystem allClockGroups cannot be driven from implicit clocks")
val prciParams = p(ChipyardPRCIControlKey) val prciParams = p(ChipyardPRCIControlKey)
@@ -48,29 +48,13 @@ trait HasChipyardPRCI { this: BaseSubsystem with InstantiatesTiles =>
// Aggregate all the clock groups into a single node // Aggregate all the clock groups into a single node
val aggregator = LazyModule(new ClockGroupAggregator("allClocks")).node val aggregator = LazyModule(new ClockGroupAggregator("allClocks")).node
val allClockGroupsNode = ClockGroupEphemeralNode()
// There are two "sets" of clocks which must be dealt with // The diplomatic clocks in the subsystem are routed to this allClockGroupsNode
// 1. The implicit clock from the subsystem. RC is moving away from depending on this
// clock, but some modules still use it. Since the implicit clock sink node
// is created in the ChipTop (the hierarchy wrapping the subsystem), this function
// is provided to allow connecting that clock to the clock aggregator. This function
// should be called in the ChipTop context
def connectImplicitClockSinkNode(sink: ClockSinkNode) = {
val implicitClockGrouper = this { ClockGroup() }
(sink
:= implicitClockGrouper
:= aggregator)
}
// 2. The rest of the diplomatic clocks in the subsystem are routed to this asyncClockGroupsNode
val clockNamePrefixer = ClockGroupNamePrefixer() val clockNamePrefixer = ClockGroupNamePrefixer()
(asyncClockGroupsNode (allClockGroupsNode
:*= clockNamePrefixer :*= clockNamePrefixer
:*= aggregator) :*= aggregator)
// Once all the clocks are gathered in the aggregator node, several steps remain // Once all the clocks are gathered in the aggregator node, several steps remain
// 1. Assign frequencies to any clock groups which did not specify a frequency. // 1. Assign frequencies to any clock groups which did not specify a frequency.
// 2. Combine duplicated clock groups (clock groups which physically should be in the same clock domain) // 2. Combine duplicated clock groups (clock groups which physically should be in the same clock domain)
@@ -91,7 +75,7 @@ trait HasChipyardPRCI { this: BaseSubsystem with InstantiatesTiles =>
} } } }
val tileResetSetter = Option.when(prciParams.enableTileResetSetting) { prci_ctrl_domain { val tileResetSetter = Option.when(prciParams.enableTileResetSetting) { prci_ctrl_domain {
val reset_setter = LazyModule(new TileResetSetter(prciParams.baseAddress + 0x10000, tlbus.beatBytes, val reset_setter = LazyModule(new TileResetSetter(prciParams.baseAddress + 0x10000, tlbus.beatBytes,
tile_prci_domains.map(_.tile_reset_domain.clockNode.portParams(0).name.get), Nil)) tile_prci_domains.map(_._2.tile_reset_domain.clockNode.portParams(0).name.get).toSeq, Nil))
reset_setter.tlNode := TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := prci_ctrl_bus.get reset_setter.tlNode := TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := prci_ctrl_bus.get
reset_setter reset_setter
} } } }
@@ -115,11 +99,14 @@ RTL SIMULATORS, NAMELY VERILATOR.
""" + Console.RESET) """ + Console.RESET)
} }
// The chiptopClockGroupsNode shouuld be what ClockBinders attach to
val chiptopClockGroupsNode = ClockGroupEphemeralNode()
(aggregator (aggregator
:= frequencySpecifier := frequencySpecifier
:= clockGroupCombiner := clockGroupCombiner
:= resetSynchronizer := resetSynchronizer
:= tileClockGater.map(_.clockNode).getOrElse(ClockGroupEphemeralNode()(ValName("temp"))) := tileClockGater.map(_.clockNode).getOrElse(ClockGroupEphemeralNode()(ValName("temp")))
:= tileResetSetter.map(_.clockNode).getOrElse(ClockGroupEphemeralNode()(ValName("temp"))) := tileResetSetter.map(_.clockNode).getOrElse(ClockGroupEphemeralNode()(ValName("temp")))
:= allClockGroupsNode) := chiptopClockGroupsNode)
} }

View File

@@ -66,7 +66,7 @@ class AbstractConfig extends Config(
new chipyard.config.WithBootROM ++ // use default bootrom new chipyard.config.WithBootROM ++ // use default bootrom
new chipyard.config.WithUART ++ // add a UART new chipyard.config.WithUART ++ // add a UART
new chipyard.config.WithL2TLBs(1024) ++ // use L2 TLBs new chipyard.config.WithL2TLBs(1024) ++ // use L2 TLBs
new chipyard.config.WithNoSubsystemDrivenClocks ++ // drive the subsystem diplomatic clocks from ChipTop instead of using implicit clocks new chipyard.config.WithNoSubsystemClockIO ++ // drive the subsystem diplomatic clocks from ChipTop instead of using implicit clocks
new chipyard.config.WithInheritBusFrequencyAssignments ++ // Unspecified clocks within a bus will receive the bus frequency if set new chipyard.config.WithInheritBusFrequencyAssignments ++ // Unspecified clocks within a bus will receive the bus frequency if set
new freechips.rocketchip.subsystem.WithNMemoryChannels(1) ++ // Default 1 memory channels new freechips.rocketchip.subsystem.WithNMemoryChannels(1) ++ // Default 1 memory channels
new freechips.rocketchip.subsystem.WithClockGateModel ++ // add default EICG_wrapper clock gate model new freechips.rocketchip.subsystem.WithClockGateModel ++ // add default EICG_wrapper clock gate model

View File

@@ -2,6 +2,7 @@ package chipyard
import org.chipsalliance.cde.config.{Config} import org.chipsalliance.cde.config.{Config}
import freechips.rocketchip.diplomacy.{AsynchronousCrossing} import freechips.rocketchip.diplomacy.{AsynchronousCrossing}
import freechips.rocketchip.subsystem.{InCluster}
// -------------- // --------------
// Rocket Configs // Rocket Configs
@@ -110,3 +111,10 @@ class PrefetchingRocketConfig extends Config(
new freechips.rocketchip.subsystem.WithNonblockingL1(2) ++ // non-blocking L1D$, L1 prefetching only works with non-blocking L1D$ new freechips.rocketchip.subsystem.WithNonblockingL1(2) ++ // non-blocking L1D$, L1 prefetching only works with non-blocking L1D$
new freechips.rocketchip.subsystem.WithNBigCores(1) ++ // single rocket-core new freechips.rocketchip.subsystem.WithNBigCores(1) ++ // single rocket-core
new chipyard.config.AbstractConfig) new chipyard.config.AbstractConfig)
class ClusteredRocketConfig extends Config(
new freechips.rocketchip.subsystem.WithNBigCores(4, location=InCluster(1)) ++
new freechips.rocketchip.subsystem.WithNBigCores(4, location=InCluster(0)) ++
new freechips.rocketchip.subsystem.WithCluster(1) ++
new freechips.rocketchip.subsystem.WithCluster(0) ++
new chipyard.config.AbstractConfig)

View File

@@ -14,7 +14,7 @@ class AbstractTraceGenConfig extends Config(
new chipyard.clocking.WithPassthroughClockGenerator ++ new chipyard.clocking.WithPassthroughClockGenerator ++
new chipyard.clocking.WithClockGroupsCombinedByName(("uncore", Seq("sbus", "implicit"), Nil)) ++ new chipyard.clocking.WithClockGroupsCombinedByName(("uncore", Seq("sbus", "implicit"), Nil)) ++
new chipyard.config.WithTracegenSystem ++ new chipyard.config.WithTracegenSystem ++
new chipyard.config.WithNoSubsystemDrivenClocks ++ new chipyard.config.WithNoSubsystemClockIO ++
new chipyard.config.WithMemoryBusFrequency(1000.0) ++ new chipyard.config.WithMemoryBusFrequency(1000.0) ++
new chipyard.config.WithSystemBusFrequency(1000.0) ++ new chipyard.config.WithSystemBusFrequency(1000.0) ++
new chipyard.config.WithPeripheryBusFrequency(1000.0) ++ new chipyard.config.WithPeripheryBusFrequency(1000.0) ++

View File

@@ -18,8 +18,8 @@ import chipyard.clocking._
// with the implicit clocks of Subsystem. Don't do that, instead we extend // with the implicit clocks of Subsystem. Don't do that, instead we extend
// the diplomacy graph upwards into the ChipTop, where we connect it to // the diplomacy graph upwards into the ChipTop, where we connect it to
// our clock drivers // our clock drivers
class WithNoSubsystemDrivenClocks extends Config((site, here, up) => { class WithNoSubsystemClockIO extends Config((site, here, up) => {
case SubsystemDriveAsyncClockGroupsKey => None case SubsystemDriveClockGroupsFromIO => false
}) })
/** /**

View File

@@ -12,15 +12,15 @@ import gemmini._
import chipyard.{TestSuitesKey, TestSuiteHelper} import chipyard.{TestSuitesKey, TestSuiteHelper}
/** /**
* Map from a hartId to a particular RoCC accelerator * Map from a tileId to a particular RoCC accelerator
*/ */
case object MultiRoCCKey extends Field[Map[Int, Seq[Parameters => LazyRoCC]]](Map.empty[Int, Seq[Parameters => LazyRoCC]]) case object MultiRoCCKey extends Field[Map[Int, Seq[Parameters => LazyRoCC]]](Map.empty[Int, Seq[Parameters => LazyRoCC]])
/** /**
* Config fragment to enable different RoCCs based on the hartId * Config fragment to enable different RoCCs based on the tileId
*/ */
class WithMultiRoCC extends Config((site, here, up) => { class WithMultiRoCC extends Config((site, here, up) => {
case BuildRoCC => site(MultiRoCCKey).getOrElse(site(TileKey).hartId, Nil) case BuildRoCC => site(MultiRoCCKey).getOrElse(site(TileKey).tileId, Nil)
}) })
/** /**
@@ -39,7 +39,7 @@ class WithMultiRoCCFromBuildRoCC(harts: Int*) extends Config((site, here, up) =>
* *
* For ex: * For ex:
* Core 0, 1, 2, 3 have been defined earlier * Core 0, 1, 2, 3 have been defined earlier
* with hartIds of 0, 1, 2, 3 respectively * with tileIds of 0, 1, 2, 3 respectively
* And you call WithMultiRoCCHwacha(0,1) * And you call WithMultiRoCCHwacha(0,1)
* Then Core 0 and 1 will get a Hwacha * Then Core 0 and 1 will get a Hwacha
* *

View File

@@ -1,12 +1,12 @@
package chipyard.config package chipyard.config
import org.chipsalliance.cde.config.{Config} import org.chipsalliance.cde.config.{Config}
import freechips.rocketchip.subsystem.{SystemBusKey, BankedL2Key, CoherenceManagerWrapper} import freechips.rocketchip.subsystem.{SystemBusKey, SubsystemBankedCoherenceKey, CoherenceManagerWrapper}
import freechips.rocketchip.diplomacy.{DTSTimebase} import freechips.rocketchip.diplomacy.{DTSTimebase}
// Replaces the L2 with a broadcast manager for maintaining coherence // Replaces the L2 with a broadcast manager for maintaining coherence
class WithBroadcastManager extends Config((site, here, up) => { class WithBroadcastManager extends Config((site, here, up) => {
case BankedL2Key => up(BankedL2Key, site).copy(coherenceManager = CoherenceManagerWrapper.broadcastManager) case SubsystemBankedCoherenceKey => up(SubsystemBankedCoherenceKey, site).copy(coherenceManager = CoherenceManagerWrapper.broadcastManager)
}) })
class WithSystemBusWidth(bitWidth: Int) extends Config((site, here, up) => { class WithSystemBusWidth(bitWidth: Int) extends Config((site, here, up) => {

View File

@@ -69,7 +69,7 @@ class WithNPMPs(n: Int = 8) extends Config((site, here, up) => {
class WithRocketICacheScratchpad extends Config((site, here, up) => { class WithRocketICacheScratchpad extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map { case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map {
case tp: RocketTileAttachParams => tp.copy(tileParams = tp.tileParams.copy( case tp: RocketTileAttachParams => tp.copy(tileParams = tp.tileParams.copy(
icache = tp.tileParams.icache.map(_.copy(itimAddr = Some(0x300000 + tp.tileParams.hartId * 0x10000))) icache = tp.tileParams.icache.map(_.copy(itimAddr = Some(0x300000 + tp.tileParams.tileId * 0x10000)))
)) ))
} }
}) })
@@ -77,7 +77,7 @@ class WithRocketICacheScratchpad extends Config((site, here, up) => {
class WithRocketDCacheScratchpad extends Config((site, here, up) => { class WithRocketDCacheScratchpad extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map { case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map {
case tp: RocketTileAttachParams => tp.copy(tileParams = tp.tileParams.copy( case tp: RocketTileAttachParams => tp.copy(tileParams = tp.tileParams.copy(
dcache = tp.tileParams.dcache.map(_.copy(nSets = 32, nWays = 1, scratch = Some(0x200000 + tp.tileParams.hartId * 0x10000))) dcache = tp.tileParams.dcache.map(_.copy(nSets = 32, nWays = 1, scratch = Some(0x200000 + tp.tileParams.tileId * 0x10000)))
)) ))
} }
}) })
@@ -85,14 +85,14 @@ class WithRocketDCacheScratchpad extends Config((site, here, up) => {
class WithTilePrefetchers extends Config((site, here, up) => { class WithTilePrefetchers extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map { case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map {
case tp: RocketTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy( case tp: RocketTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy(
master = TilePrefetchingMasterPortParams(tp.tileParams.hartId, tp.crossingParams.master))) master = TilePrefetchingMasterPortParams(tp.tileParams.tileId, tp.crossingParams.master)))
case tp: BoomTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy( case tp: BoomTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy(
master = TilePrefetchingMasterPortParams(tp.tileParams.hartId, tp.crossingParams.master))) master = TilePrefetchingMasterPortParams(tp.tileParams.tileId, tp.crossingParams.master)))
case tp: SodorTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy( case tp: SodorTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy(
master = TilePrefetchingMasterPortParams(tp.tileParams.hartId, tp.crossingParams.master))) master = TilePrefetchingMasterPortParams(tp.tileParams.tileId, tp.crossingParams.master)))
case tp: IbexTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy( case tp: IbexTileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy(
master = TilePrefetchingMasterPortParams(tp.tileParams.hartId, tp.crossingParams.master))) master = TilePrefetchingMasterPortParams(tp.tileParams.tileId, tp.crossingParams.master)))
case tp: CVA6TileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy( case tp: CVA6TileAttachParams => tp.copy(crossingParams = tp.crossingParams.copy(
master = TilePrefetchingMasterPortParams(tp.tileParams.hartId, tp.crossingParams.master))) master = TilePrefetchingMasterPortParams(tp.tileParams.tileId, tp.crossingParams.master)))
} }
}) })

View File

@@ -24,9 +24,6 @@ class FlatChipTop(implicit p: Parameters) extends LazyModule {
//======================== //========================
// Diplomatic clock stuff // Diplomatic clock stuff
//======================== //========================
val implicitClockSinkNode = ClockSinkNode(Seq(ClockSinkParameters(name = Some("implicit_clock"))))
system.connectImplicitClockSinkNode(implicitClockSinkNode)
val tlbus = system.locateTLBusWrapper(system.prciParams.slaveWhere) val tlbus = system.locateTLBusWrapper(system.prciParams.slaveWhere)
val baseAddress = system.prciParams.baseAddress val baseAddress = system.prciParams.baseAddress
val clockDivider = system.prci_ctrl_domain { LazyModule(new TLClockDivider (baseAddress + 0x20000, tlbus.beatBytes)) } val clockDivider = system.prci_ctrl_domain { LazyModule(new TLClockDivider (baseAddress + 0x20000, tlbus.beatBytes)) }
@@ -37,7 +34,7 @@ class FlatChipTop(implicit p: Parameters) extends LazyModule {
tlbus.coupleTo("clock-sel-ctrl") { clockSelector.tlNode := TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := TLBuffer() := _ } tlbus.coupleTo("clock-sel-ctrl") { clockSelector.tlNode := TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := TLBuffer() := _ }
tlbus.coupleTo("pll-ctrl") { pllCtrl.tlNode := TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := TLBuffer() := _ } tlbus.coupleTo("pll-ctrl") { pllCtrl.tlNode := TLFragmenter(tlbus.beatBytes, tlbus.blockBytes) := TLBuffer() := _ }
system.allClockGroupsNode := clockDivider.clockNode := clockSelector.clockNode system.chiptopClockGroupsNode := clockDivider.clockNode := clockSelector.clockNode
// Connect all other requested clocks // Connect all other requested clocks
val slowClockSource = ClockSourceNode(Seq(ClockSourceParameters())) val slowClockSource = ClockSourceNode(Seq(ClockSourceParameters()))
@@ -61,13 +58,6 @@ class FlatChipTop(implicit p: Parameters) extends LazyModule {
//========================= //=========================
// Clock/reset // Clock/reset
//========================= //=========================
val implicit_clock = implicitClockSinkNode.in.head._1.clock
val implicit_reset = implicitClockSinkNode.in.head._1.reset
system.module match { case l: LazyModuleImp => {
l.clock := implicit_clock
l.reset := implicit_reset
}}
val clock_wire = Wire(Input(Clock())) val clock_wire = Wire(Input(Clock()))
val reset_wire = Wire(Input(AsyncReset())) val reset_wire = Wire(Input(AsyncReset()))
val (clock_pad, clockIOCell) = IOCell.generateIOFromSignal(clock_wire, "clock", p(IOCellKey)) val (clock_pad, clockIOCell) = IOCell.generateIOFromSignal(clock_wire, "clock", p(IOCellKey))

View File

@@ -185,7 +185,7 @@ trait CanHavePeripheryGCD { this: BaseSubsystem =>
// DOC include end: GCD lazy trait // DOC include end: GCD lazy trait
// DOC include start: GCD imp trait // DOC include start: GCD imp trait
trait CanHavePeripheryGCDModuleImp extends LazyModuleImp { trait CanHavePeripheryGCDModuleImp extends LazyRawModuleImp {
val outer: CanHavePeripheryGCD val outer: CanHavePeripheryGCD
val gcd_busy = outer.gcd match { val gcd_busy = outer.gcd match {
case Some(gcd) => { case Some(gcd) => {

View File

@@ -82,7 +82,7 @@ case class MyTileAttachParams(
case class MyTileParams( case class MyTileParams(
name: Option[String] = Some("my_tile"), name: Option[String] = Some("my_tile"),
hartId: Int = 0, tileId: Int = 0,
trace: Boolean = false, trace: Boolean = false,
val core: MyCoreParams = MyCoreParams() val core: MyCoreParams = MyCoreParams()
) extends InstantiableTileParams[MyTile] ) extends InstantiableTileParams[MyTile]
@@ -94,9 +94,11 @@ case class MyTileParams(
val dcache: Option[DCacheParams] = Some(DCacheParams()) val dcache: Option[DCacheParams] = Some(DCacheParams())
val icache: Option[ICacheParams] = Some(ICacheParams()) val icache: Option[ICacheParams] = Some(ICacheParams())
val clockSinkParams: ClockSinkParameters = ClockSinkParameters() val clockSinkParams: ClockSinkParameters = ClockSinkParameters()
def instantiate(crossing: TileCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters): MyTile = { def instantiate(crossing: HierarchicalElementCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters): MyTile = {
new MyTile(this, crossing, lookup) new MyTile(this, crossing, lookup)
} }
val baseName = name.getOrElse("my_tile")
val uniqueName = s"${baseName}_$tileId"
} }
// DOC include start: Tile class // DOC include start: Tile class
@@ -111,11 +113,11 @@ class MyTile(
{ {
// Private constructor ensures altered LazyModule.p is used implicitly // Private constructor ensures altered LazyModule.p is used implicitly
def this(params: MyTileParams, crossing: TileCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters) = def this(params: MyTileParams, crossing: HierarchicalElementCrossingParamsLike, lookup: LookupByHartIdImpl)(implicit p: Parameters) =
this(params, crossing.crossingType, lookup, p) this(params, crossing.crossingType, lookup, p)
// Require TileLink nodes // Require TileLink nodes
val intOutwardNode = IntIdentityNode() val intOutwardNode = Some(IntIdentityNode())
val masterNode = visibilityNode val masterNode = visibilityNode
val slaveNode = TLIdentityNode() val slaveNode = TLIdentityNode()
@@ -135,7 +137,7 @@ class MyTile(
} }
ResourceBinding { ResourceBinding {
Resource(cpuDevice, "reg").bind(ResourceAddress(hartId)) Resource(cpuDevice, "reg").bind(ResourceAddress(tileId))
} }
// TODO: Create TileLink nodes and connections here. // TODO: Create TileLink nodes and connections here.
@@ -228,15 +230,15 @@ class MyTileModuleImp(outer: MyTile) extends BaseTileModuleImp(outer){
} }
// DOC include start: Config fragment // DOC include start: Config fragment
class WithNMyCores(n: Int = 1, overrideIdOffset: Option[Int] = None) extends Config((site, here, up) => { class WithNMyCores(n: Int = 1) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => { case TilesLocated(InSubsystem) => {
// Calculate the next available hart ID (since hart ID cannot be duplicated) // Calculate the next available hart ID (since hart ID cannot be duplicated)
val prev = up(TilesLocated(InSubsystem), site) val prev = up(TilesLocated(InSubsystem), site)
val idOffset = overrideIdOffset.getOrElse(prev.size) val idOffset = up(NumTiles)
// Create TileAttachParams for every core to be instantiated // Create TileAttachParams for every core to be instantiated
(0 until n).map { i => (0 until n).map { i =>
MyTileAttachParams( MyTileAttachParams(
tileParams = MyTileParams(hartId = i + idOffset), tileParams = MyTileParams(tileId = i + idOffset),
crossingParams = RocketCrossingParams() crossingParams = RocketCrossingParams()
) )
} ++ prev } ++ prev
@@ -245,5 +247,6 @@ class WithNMyCores(n: Int = 1, overrideIdOffset: Option[Int] = None) extends Con
case SystemBusKey => up(SystemBusKey, site).copy(beatBytes = 8) case SystemBusKey => up(SystemBusKey, site).copy(beatBytes = 8)
// The # of instruction bits. Use maximum # of bits if your core supports both 32 and 64 bits. // The # of instruction bits. Use maximum # of bits if your core supports both 32 and 64 bits.
case XLen => 64 case XLen => 64
case NumTiles => up(NumTiles) + n
}) })
// DOC include end: Config fragment // DOC include end: Config fragment

View File

@@ -453,14 +453,14 @@ class WithTraceGenSuccessPunchthrough extends OverrideIOBinder({
} }
}) })
class WithTraceIOPunchthrough extends OverrideIOBinder({ class WithTraceIOPunchthrough extends OverrideLazyIOBinder({
(system: CanHaveTraceIOModuleImp) => { (system: CanHaveTraceIO) => InModuleBody {
val ports: Option[TracePort] = system.traceIO.map { t => val ports: Option[TracePort] = system.traceIO.map { t =>
val trace = IO(DataMirror.internal.chiselTypeClone[TraceOutputTop](t)).suggestName("trace") val trace = IO(DataMirror.internal.chiselTypeClone[TraceOutputTop](t)).suggestName("trace")
trace <> t trace <> t
val p = GetSystemParameters(system) val p = GetSystemParameters(system)
val chipyardSystem = system.asInstanceOf[ChipyardSystemModule[_]].outer.asInstanceOf[ChipyardSystem] val chipyardSystem = system.asInstanceOf[ChipyardSystemModule[_]].outer.asInstanceOf[ChipyardSystem]
val tiles = chipyardSystem.tiles val tiles = chipyardSystem.totalTiles.values
val cfg = SpikeCosimConfig( val cfg = SpikeCosimConfig(
isa = tiles.headOption.map(_.isaDTS).getOrElse(""), isa = tiles.headOption.map(_.isaDTS).getOrElse(""),
vlen = tiles.headOption.map(_.tileParams.core.vLen).getOrElse(0), vlen = tiles.headOption.map(_.tileParams.core.vLen).getOrElse(0),
@@ -509,8 +509,8 @@ class WithDontTouchPorts extends OverrideIOBinder({
}) })
class WithNMITiedOff extends ComposeIOBinder({ class WithNMITiedOff extends ComposeIOBinder({
(system: HasTilesModuleImp) => { (system: HasHierarchicalElementsRootContextModuleImp) => {
system.nmi.flatten.foreach { nmi => system.nmi.foreach { nmi =>
nmi.rnmi := false.B nmi.rnmi := false.B
nmi.rnmi_interrupt_vector := 0.U nmi.rnmi_interrupt_vector := 0.U
nmi.rnmi_exception_vector := 0.U nmi.rnmi_exception_vector := 0.U

View File

@@ -8,7 +8,7 @@ import chisel3._
import chisel3.experimental.{IO, annotate} import chisel3.experimental.{IO, annotate}
import freechips.rocketchip.prci._ import freechips.rocketchip.prci._
import freechips.rocketchip.subsystem.{BaseSubsystem, SubsystemDriveAsyncClockGroupsKey, HasTiles} import freechips.rocketchip.subsystem._
import org.chipsalliance.cde.config.{Field, Config, Parameters} import org.chipsalliance.cde.config.{Field, Config, Parameters}
import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, InModuleBody, ValName} import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, InModuleBody, ValName}
import freechips.rocketchip.util.{ResetCatchAndSync, RecordMap} import freechips.rocketchip.util.{ResetCatchAndSync, RecordMap}
@@ -103,8 +103,8 @@ class FireSim(implicit val p: Parameters) extends RawModule with HasHarnessInsta
// FireSim ModelMultithreading // FireSim ModelMultithreading
chiptops.foreach { chiptops.foreach {
case c: ChipTop => c.lazySystem match { case c: ChipTop => c.lazySystem match {
case ls: HasTiles => { case ls: InstantiatesHierarchicalElements => {
if (p(FireSimMultiCycleRegFile)) ls.tiles.map { if (p(FireSimMultiCycleRegFile)) ls.totalTiles.values.map {
case r: RocketTile => { case r: RocketTile => {
annotate(MemModelAnnotation(r.module.core.rocketImpl.rf.rf)) annotate(MemModelAnnotation(r.module.core.rocketImpl.rf.rf))
r.module.fpuOpt.foreach(fpu => annotate(MemModelAnnotation(fpu.fpuImpl.regfile))) r.module.fpuOpt.foreach(fpu => annotate(MemModelAnnotation(fpu.fpuImpl.regfile)))
@@ -120,7 +120,7 @@ class FireSim(implicit val p: Parameters) extends RawModule with HasHarnessInsta
} }
case _ => case _ =>
} }
if (p(FireSimFAME5)) ls.tiles.map { if (p(FireSimFAME5)) ls.totalTiles.values.map {
case b: BoomTile => case b: BoomTile =>
annotate(EnableModelMultiThreadingAnnotation(b.module)) annotate(EnableModelMultiThreadingAnnotation(b.module))
case r: RocketTile => case r: RocketTile =>

View File

@@ -13,19 +13,18 @@ import scala.math.{max, min}
class WithTraceGen( class WithTraceGen(
n: Int = 2, n: Int = 2,
overrideIdOffset: Option[Int] = None,
overrideMemOffset: Option[BigInt] = None)( overrideMemOffset: Option[BigInt] = None)(
params: Seq[DCacheParams] = List.fill(n){ DCacheParams(nSets = 16, nWays = 1) }, params: Seq[DCacheParams] = List.fill(n){ DCacheParams(nSets = 16, nWays = 1) },
nReqs: Int = 8192 nReqs: Int = 8192
) extends Config((site, here, up) => { ) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => { case TilesLocated(InSubsystem) => {
val prev = up(TilesLocated(InSubsystem), site) val prev = up(TilesLocated(InSubsystem), site)
val idOffset = overrideIdOffset.getOrElse(prev.size) val idOffset = up(NumTiles)
val memOffset: BigInt = overrideMemOffset.orElse(site(ExtMem).map(_.master.base)).getOrElse(0x0L) val memOffset: BigInt = overrideMemOffset.orElse(site(ExtMem).map(_.master.base)).getOrElse(0x0L)
params.zipWithIndex.map { case (dcp, i) => params.zipWithIndex.map { case (dcp, i) =>
TraceGenTileAttachParams( TraceGenTileAttachParams(
tileParams = TraceGenParams( tileParams = TraceGenParams(
hartId = i + idOffset, tileId = i + idOffset,
dcache = Some(dcp), dcache = Some(dcp),
wordBits = site(XLen), wordBits = site(XLen),
addrBits = 48, addrBits = 48,
@@ -48,23 +47,23 @@ class WithTraceGen(
) )
} ++ prev } ++ prev
} }
case NumTiles => up(NumTiles) + n
}) })
class WithBoomTraceGen( class WithBoomTraceGen(
n: Int = 2, n: Int = 2,
overrideIdOffset: Option[Int] = None,
overrideMemOffset: Option[BigInt] = None)( overrideMemOffset: Option[BigInt] = None)(
params: Seq[DCacheParams] = List.fill(n){ DCacheParams(nMSHRs = 4, nSets = 16, nWays = 2) }, params: Seq[DCacheParams] = List.fill(n){ DCacheParams(nMSHRs = 4, nSets = 16, nWays = 2) },
nReqs: Int = 8192 nReqs: Int = 8192
) extends Config((site, here, up) => { ) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => { case TilesLocated(InSubsystem) => {
val prev = up(TilesLocated(InSubsystem), site) val prev = up(TilesLocated(InSubsystem), site)
val idOffset = overrideIdOffset.getOrElse(prev.size) val idOffset = up(NumTiles)
val memOffset: BigInt = overrideMemOffset.orElse(site(ExtMem).map(_.master.base)).getOrElse(0x0L) val memOffset: BigInt = overrideMemOffset.orElse(site(ExtMem).map(_.master.base)).getOrElse(0x0L)
params.zipWithIndex.map { case (dcp, i) => params.zipWithIndex.map { case (dcp, i) =>
BoomTraceGenTileAttachParams( BoomTraceGenTileAttachParams(
tileParams = BoomTraceGenParams( tileParams = BoomTraceGenParams(
hartId = i + idOffset, tileId = i + idOffset,
dcache = Some(dcp), dcache = Some(dcp),
wordBits = site(XLen), wordBits = site(XLen),
addrBits = 48, addrBits = 48,
@@ -84,24 +83,24 @@ class WithBoomTraceGen(
) )
} ++ prev } ++ prev
} }
case NumTiles => up(NumTiles) + n
}) })
class WithL2TraceGen( class WithL2TraceGen(
n: Int = 2, n: Int = 2,
overrideIdOffset: Option[Int] = None,
overrideMemOffset: Option[BigInt] = None)( overrideMemOffset: Option[BigInt] = None)(
params: Seq[DCacheParams] = List.fill(n){ DCacheParams(nSets = 16, nWays = 1) }, params: Seq[DCacheParams] = List.fill(n){ DCacheParams(nSets = 16, nWays = 1) },
nReqs: Int = 8192 nReqs: Int = 8192
) extends Config((site, here, up) => { ) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => { case TilesLocated(InSubsystem) => {
val prev = up(TilesLocated(InSubsystem), site) val prev = up(TilesLocated(InSubsystem), site)
val idOffset = overrideIdOffset.getOrElse(prev.size) val idOffset = up(NumTiles)
val memOffset: BigInt = overrideMemOffset.orElse(site(ExtMem).map(_.master.base)).getOrElse(0x0L) val memOffset: BigInt = overrideMemOffset.orElse(site(ExtMem).map(_.master.base)).getOrElse(0x0L)
params.zipWithIndex.map { case (dcp, i) => params.zipWithIndex.map { case (dcp, i) =>
TraceGenTileAttachParams( TraceGenTileAttachParams(
tileParams = TraceGenParams( tileParams = TraceGenParams(
hartId = i + idOffset, tileId = i + idOffset,
dcache = Some(dcp), dcache = Some(dcp),
wordBits = site(XLen), wordBits = site(XLen),
addrBits = 48, addrBits = 48,
@@ -126,4 +125,5 @@ class WithL2TraceGen(
) )
} ++ prev } ++ prev
} }
case NumTiles => up(NumTiles) + n
}) })

View File

@@ -9,11 +9,12 @@ import freechips.rocketchip.subsystem._
import boom.lsu.BoomTraceGenTile import boom.lsu.BoomTraceGenTile
class TraceGenSystem(implicit p: Parameters) extends BaseSubsystem class TraceGenSystem(implicit p: Parameters) extends BaseSubsystem
with HasTiles with InstantiatesHierarchicalElements
with HasTileNotificationSinks
with CanHaveMasterAXI4MemPort { with CanHaveMasterAXI4MemPort {
def coreMonitorBundles = Nil def coreMonitorBundles = Nil
val tileStatusNodes = tiles.collect { val tileStatusNodes = totalTiles.values.toSeq.collect {
case t: GroundTestTile => t.statusNode.makeSink() case t: GroundTestTile => t.statusNode.makeSink()
case t: BoomTraceGenTile => t.statusNode.makeSink() case t: BoomTraceGenTile => t.statusNode.makeSink()
} }