1
0

diplomacy: rename {Left,Right}Star to refer to {Source,Sink}Cardinality

This commit is contained in:
Wesley W. Terpstra 2017-09-07 15:03:09 -07:00
parent bef593c21a
commit 06a244f9f9
2 changed files with 8 additions and 8 deletions

View File

@ -22,16 +22,16 @@ package object diplomacy
} }
} }
def LeftStar[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial { def SinkCardinality[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.SINK_TO_SOURCE case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.SINK_TO_SOURCE
}) })
def RightStar[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial { def SourceCardinality[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.SOURCE_TO_SINK case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.SOURCE_TO_SINK
}) })
def NoStar[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial { def UnaryCardinality[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.NO_INFERENCE case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.NO_INFERENCE
}) })
def FlipStar[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial { def FlipCardinality[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
case CardinalityInferenceDirectionKey => p(CardinalityInferenceDirectionKey).flip case CardinalityInferenceDirectionKey => p(CardinalityInferenceDirectionKey).flip
}) })
def EnableMonitors[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial { def EnableMonitors[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {

View File

@ -68,7 +68,7 @@ abstract class TLBusWrapper(params: TLBusParams, val busName: String)(implicit p
protected def inwardBufNode: TLInwardNode = master_buffer.node protected def inwardBufNode: TLInwardNode = master_buffer.node
protected def bufferChain(depth: Int, name: Option[String] = None): (TLInwardNode, TLOutwardNode) = { protected def bufferChain(depth: Int, name: Option[String] = None): (TLInwardNode, TLOutwardNode) = {
RightStar { implicit p => SourceCardinality { implicit p =>
val chain = LazyModule(new TLBufferChain(depth)) val chain = LazyModule(new TLBufferChain(depth))
name.foreach { n => chain.suggestName(s"${busName}_${n}_TLBufferChain")} name.foreach { n => chain.suggestName(s"${busName}_${n}_TLBufferChain")}
(chain.nodeIn, chain.nodeOut) (chain.nodeIn, chain.nodeOut)
@ -79,18 +79,18 @@ abstract class TLBusWrapper(params: TLBusParams, val busName: String)(implicit p
def bufferToSlaves: TLOutwardNode = outwardBufNode def bufferToSlaves: TLOutwardNode = outwardBufNode
def toSyncSlaves(name: Option[String] = None, addBuffers: Int = 0): TLOutwardNode = LeftStar { implicit p => def toSyncSlaves(name: Option[String] = None, addBuffers: Int = 0): TLOutwardNode = SinkCardinality { implicit p =>
TLBufferChain(addBuffers)(outwardBufNode) TLBufferChain(addBuffers)(outwardBufNode)
} }
def toAsyncSlaves(sync: Int = 3, name: Option[String] = None, addBuffers: Int = 0): TLAsyncOutwardNode = LeftStar { implicit p => def toAsyncSlaves(sync: Int = 3, name: Option[String] = None, addBuffers: Int = 0): TLAsyncOutwardNode = SinkCardinality { implicit p =>
val source = LazyModule(new TLAsyncCrossingSource(sync)) val source = LazyModule(new TLAsyncCrossingSource(sync))
name.foreach{ n => source.suggestName(s"${busName}_${n}_TLAsyncCrossingSource")} name.foreach{ n => source.suggestName(s"${busName}_${n}_TLAsyncCrossingSource")}
source.node :=? TLBufferChain(addBuffers)(outwardNode) source.node :=? TLBufferChain(addBuffers)(outwardNode)
source.node source.node
} }
def toRationalSlaves(name: Option[String] = None, addBuffers: Int = 0): TLRationalOutwardNode = LeftStar { implicit p => def toRationalSlaves(name: Option[String] = None, addBuffers: Int = 0): TLRationalOutwardNode = SinkCardinality { implicit p =>
val source = LazyModule(new TLRationalCrossingSource()) val source = LazyModule(new TLRationalCrossingSource())
name.foreach{ n => source.suggestName(s"${busName}_${n}_TLRationalCrossingSource")} name.foreach{ n => source.suggestName(s"${busName}_${n}_TLRationalCrossingSource")}
source.node :=? TLBufferChain(addBuffers)(outwardNode) source.node :=? TLBufferChain(addBuffers)(outwardNode)