Skip to content

Commit

Permalink
Generalize WithNBigCores to support clustered cores
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Oct 17, 2023
1 parent f745cff commit ef1d671
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
52 changes: 16 additions & 36 deletions src/main/scala/subsystem/Configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ class WithCoherentBusTopology extends Config((site, here, up) => {

class WithNBigCores(
n: Int,
crossing: RocketCrossingParams = RocketCrossingParams()
location: HierarchicalLocation,
crossing: RocketCrossingParams,
) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => {
val prev = up(TilesLocated(InSubsystem), site)
case TilesLocated(`location`) => {
val prev = up(TilesLocated(`location`), site)
val idOffset = up(NumTiles)
val big = RocketTileParams(
core = RocketCoreParams(mulDiv = Some(MulDivParams(
Expand All @@ -113,7 +114,18 @@ class WithNBigCores(
)) ++ prev
}
case NumTiles => up(NumTiles) + n
})
}) {
def this(n: Int, location: HierarchicalLocation = InSubsystem) = this(n, location, RocketCrossingParams(
master = HierarchicalElementMasterPortParams.locationDefault(location),
slave = HierarchicalElementSlavePortParams.locationDefault(location),
mmioBaseAddressPrefixWhere = location match {
case InSubsystem => CBUS
case InCluster(clusterId) => CCBUS(clusterId)
}
))
}



class WithNMedCores(
n: Int,
Expand Down Expand Up @@ -218,38 +230,6 @@ class With1TinyCore extends Config((site, here, up) => {
case ClustersLocated(_) => Nil
})

class WithNClusterCores(
n: Int,
clusterId: Int
) extends Config((site, here, up) => {
case TilesLocated(InCluster(`clusterId`)) => {
val prev = up(TilesLocated(InCluster(clusterId)), site)
val idOffset = up(NumTiles)
val big = RocketTileParams(
core = RocketCoreParams(mulDiv = Some(MulDivParams(
mulUnroll = 8,
mulEarlyOut = true,
divEarlyOut = true))),
dcache = Some(DCacheParams(
rowBits = site(SystemBusKey).beatBits,
nMSHRs = 0,
blockBytes = site(CacheBlockBytes))),
icache = Some(ICacheParams(
rowBits = site(SystemBusKey).beatBits,
blockBytes = site(CacheBlockBytes))))
List.tabulate(n)(i => RocketTileAttachParams(
big.copy(tileId = i + idOffset),
RocketCrossingParams(
master = HierarchicalElementMasterPortParams(where=CSBUS(clusterId)),
slave = HierarchicalElementSlavePortParams(where=CCBUS(clusterId), blockerCtrlWhere=CCBUS(clusterId)),
mmioBaseAddressPrefixWhere = CCBUS(clusterId)
)
)) ++ prev
}
case NumTiles => up(NumTiles) + n
})


class WithCluster(
clusterId: Int,
location: HierarchicalLocation = InSubsystem,
Expand Down
14 changes: 14 additions & 0 deletions src/main/scala/subsystem/HasHierarchicalElements.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ case class HierarchicalElementMasterPortParams(
}
}

object HierarchicalElementMasterPortParams {
def locationDefault(loc: HierarchicalLocation) = loc match {
case InSubsystem => HierarchicalElementMasterPortParams()
case InCluster(clusterId) => HierarchicalElementMasterPortParams(where=CSBUS(clusterId))
}
}

/** A default implementation of parameterizing the connectivity of the port giving access to slaves inside the tile.
* Optional timing buffers and/or an optional BusBlocker adapter can be inserted in the interconnect's clock domain.
*/
Expand All @@ -51,6 +58,13 @@ case class HierarchicalElementSlavePortParams(
}
}

object HierarchicalElementSlavePortParams {
def locationDefault(loc: HierarchicalLocation) = loc match {
case InSubsystem => HierarchicalElementSlavePortParams()
case InCluster(clusterId) => HierarchicalElementSlavePortParams(where=CCBUS(clusterId), blockerCtrlWhere=CCBUS(clusterId))
}
}

/** InstantiatesTiles adds a Config-urable sequence of HierarchicalElements of any type
* to the subsystem class into which it is mixed.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/system/Configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class DualChannelConfig extends Config(new WithNMemoryChannels(2) ++ new Default
class EightChannelConfig extends Config(new WithNMemoryChannels(8) ++ new DefaultConfig)

class ClusterConfig extends Config(
new WithNClusterCores(2, clusterId=3) ++
new WithNClusterCores(2, clusterId=1) ++
new WithNClusterCores(2, clusterId=0) ++
new WithNBigCores(2, InCluster(3)) ++
new WithNBigCores(2, InCluster(1)) ++
new WithNBigCores(2, InCluster(0)) ++
new WithCluster(3, location=InCluster(2)) ++
new WithCluster(2) ++
new WithCluster(1) ++
Expand Down

0 comments on commit ef1d671

Please sign in to comment.