diplomacy: implement DisableMonitors scope
This commit is contained in:
@ -23,9 +23,11 @@ object CardinalityInferenceDirection {
|
||||
case object NO_INFERENCE extends T
|
||||
}
|
||||
|
||||
case object CardinalityInferenceDirectionKey extends
|
||||
private case object CardinalityInferenceDirectionKey extends
|
||||
Field[CardinalityInferenceDirection.T](CardinalityInferenceDirection.NO_INFERENCE)
|
||||
|
||||
private case object MonitorsEnabled extends Field[Boolean](true)
|
||||
|
||||
// DI = Downwards flowing Parameters received on the inner side of the node
|
||||
// UI = Upwards flowing Parameters generated by the inner side of the node
|
||||
// EI = Edge Parameters describing a connection on the inner side of the node
|
||||
@ -249,7 +251,7 @@ abstract class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
|
||||
lazy val bundleIn = wireI(flipI(HeterogeneousBag(edgesIn .map(inner.bundleI(_)))))
|
||||
|
||||
// connects the outward part of a node with the inward part of this node
|
||||
private def bind(h: OutwardNodeHandle[DI, UI, BI], binding: NodeBinding, enableMonitoring: Boolean)
|
||||
private def bind(h: OutwardNodeHandle[DI, UI, BI], binding: NodeBinding)
|
||||
(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = {
|
||||
val x = this // x := y
|
||||
val y = h.outward
|
||||
@ -276,14 +278,14 @@ abstract class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
|
||||
(x.bundleIn(iStart+j), y.bundleOut(oStart+j))
|
||||
}
|
||||
}
|
||||
val (out, newbinding) = inner.connect(edges _, bundles _, enableMonitoring)
|
||||
val (out, newbinding) = inner.connect(edges _, bundles _, p(MonitorsEnabled))
|
||||
LazyModule.stack.head.bindings = newbinding :: LazyModule.stack.head.bindings
|
||||
out
|
||||
}
|
||||
|
||||
override def := (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_ONCE, true)
|
||||
override def :*= (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_STAR, true)
|
||||
override def :=* (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_QUERY, true)
|
||||
override def := (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_ONCE)
|
||||
override def :*= (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_STAR)
|
||||
override def :=* (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_QUERY)
|
||||
override def :=? (h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = {
|
||||
p(CardinalityInferenceDirectionKey) match {
|
||||
case CardinalityInferenceDirection.SOURCE_TO_SINK => this :=* h
|
||||
@ -292,10 +294,6 @@ abstract class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
|
||||
}
|
||||
}
|
||||
|
||||
def connectButDontMonitor(h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_ONCE, false)
|
||||
def connectButDontMonitorSlaves(h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_STAR, false)
|
||||
def connectButDontMonitorMasters(h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_QUERY, false)
|
||||
|
||||
// meta-data for printing the node graph
|
||||
protected[diplomacy] def colour = inner.colour
|
||||
protected[diplomacy] def reverse = inner.reverse
|
||||
|
@ -34,4 +34,10 @@ package object diplomacy
|
||||
def FlipStar[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
|
||||
case CardinalityInferenceDirectionKey => p(CardinalityInferenceDirectionKey).flip
|
||||
})
|
||||
def EnableMonitors[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
|
||||
case MonitorsEnabled => true
|
||||
})
|
||||
def DisableMonitors[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
|
||||
case MonitorsEnabled => false
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user