Skip to content

Commit

Permalink
subsystem: move nBanks and binder to CoherenceManagerWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
hcook committed Mar 30, 2020
1 parent 2cd4d58 commit e93ec18
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
15 changes: 12 additions & 3 deletions src/main/scala/subsystem/BankedL2Params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ case class BankedL2Params(
}


case class CoherenceManagerWrapperParams(blockBytes: Int, beatBytes: Int, name: String)
case class CoherenceManagerWrapperParams(
blockBytes: Int,
beatBytes: Int,
nBanks: Int,
name: String)
(val coherenceManager: CoherenceManagerWrapper.CoherenceManagerInstantiationFn)
extends HasTLBusParams
with TLBusWrapperInstantiationLike
Expand All @@ -56,9 +60,14 @@ object CoherenceManagerWrapper {
}

class CoherenceManagerWrapper(params: CoherenceManagerWrapperParams, context: HasTileLinkLocations)(implicit p: Parameters) extends TLBusWrapper(params, params.name) {
val (temp, outwardNode, halt) = params.coherenceManager(context)
val (tempIn, tempOut, halt) = params.coherenceManager(context)

// TODO could remove temp if we could get access to .edges from InwardNodeHandle
val viewNode = TLIdentityNode()
val inwardNode = temp :*= viewNode
def busView: TLEdge = viewNode.edges.out.head
val inwardNode = tempIn :*= viewNode

private def banked(node: TLOutwardNode): TLOutwardNode =
if (params.nBanks == 0) node else { TLTempNode() :=* BankBinder(params.nBanks, params.blockBytes) :*= node }
val outwardNode = banked(tempOut)
}
2 changes: 1 addition & 1 deletion src/main/scala/subsystem/BusTopology.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case class CoherentBusTopologyParams(
) extends TLBusWrapperTopology(
instantiations = (if (l2.nBanks == 0) Nil else List(
(MBUS, mbus),
(L2, CoherenceManagerWrapperParams(sbus.blockBytes, sbus.beatBytes, L2.name)(l2.coherenceManager)))),
(L2, CoherenceManagerWrapperParams(sbus.blockBytes, sbus.beatBytes, l2.nBanks, L2.name)(l2.coherenceManager)))),
connections = (if (l2.nBanks == 0) Nil else List(
(SBUS, L2, TLBusWrapperConnection.crossTo(NoCrossing)),
(L2, MBUS, TLBusWrapperConnection.crossTo(NoCrossing))
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/subsystem/Configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class BaseSubsystemConfig extends Config ((site, here, up) => {
case MemoryBusKey => MemoryBusParams(
beatBytes = site(XLen)/8,
blockBytes = site(CacheBlockBytes),
replicatorMask = site(MultiChipMaskKey),
nInwardBanks = site(BankedL2Key).nBanks)
replicatorMask = site(MultiChipMaskKey))
case FrontBusKey => FrontBusParams(
beatBytes = site(XLen)/8,
blockBytes = site(CacheBlockBytes))
Expand Down
9 changes: 3 additions & 6 deletions src/main/scala/subsystem/MemoryBus.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ case class MemoryBusParams(
dtsFrequency: Option[BigInt] = None,
zeroDevice: Option[AddressSet] = None,
errorDevice: Option[DevNullParams] = None,
replicatorMask: BigInt = 0,
nInwardBanks: Int = 0)
replicatorMask: BigInt = 0)
extends HasTLBusParams
with HasBuiltInDeviceParams
with HasRegionReplicatorParams
Expand All @@ -39,10 +38,8 @@ class MemoryBus(params: MemoryBusParams, name: String = "memory_bus")(implicit p
private val xbar = LazyModule(new TLXbar).suggestName(busName + "_xbar")
private def replicate(node: TLInwardNode): TLInwardNode =
if (params.replicatorMask == 0) node else { node :=* RegionReplicator(params.replicatorMask) }
private def bank(node: TLInwardNode): TLInwardNode =
if (params.nInwardBanks == 0) node else { node :=* BankBinder(params.nInwardBanks, blockBytes) :*= TLTempNode() }
def inwardNode: TLInwardNode = this { bank(replicate(xbar.node)) }
def outwardNode: TLOutwardNode = ProbePicker() :*= xbar.node
val inwardNode: TLInwardNode = replicate(xbar.node)
val outwardNode: TLOutwardNode = ProbePicker() :*= xbar.node
def busView: TLEdge = xbar.node.edges.in.head
attachBuiltInDevices(params)
}

0 comments on commit e93ec18

Please sign in to comment.