1
0

diplomacy: a type of connect that always disables monitors (#828)

This commit is contained in:
Henry Cook 2017-06-28 21:48:10 -07:00 committed by Wesley W. Terpstra
parent 992b480c74
commit 6e5a4c687f
4 changed files with 18 additions and 13 deletions

View File

@ -18,7 +18,8 @@ trait InwardNodeImp[DI, UI, EI, BI <: Data]
def bundleI(ei: EI): BI def bundleI(ei: EI): BI
def colour: String def colour: String
def reverse: Boolean = false def reverse: Boolean = false
def connect(edges: () => Seq[EI], bundles: () => Seq[(BI, BI)])(implicit p: Parameters, sourceInfo: SourceInfo): (Option[MonitorBase], () => Unit) = { def connect(edges: () => Seq[EI], bundles: () => Seq[(BI, BI)], enableMonitoring: Boolean)
(implicit p: Parameters, sourceInfo: SourceInfo): (Option[MonitorBase], () => Unit) = {
(None, () => bundles().foreach { case (i, o) => i <> o }) (None, () => bundles().foreach { case (i, o) => i <> o })
} }
@ -229,7 +230,8 @@ abstract class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
lazy val bundleIn = wireI(flipI(HeterogeneousBag(edgesIn .map(inner.bundleI(_))))) lazy val bundleIn = wireI(flipI(HeterogeneousBag(edgesIn .map(inner.bundleI(_)))))
// connects the outward part of a node with the inward part of this node // connects the outward part of a node with the inward part of this node
private def bind(h: OutwardNodeHandle[DI, UI, BI], binding: NodeBinding)(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = { private def bind(h: OutwardNodeHandle[DI, UI, BI], binding: NodeBinding, enableMonitoring: Boolean)
(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = {
val x = this // x := y val x = this // x := y
val y = h.outward val y = h.outward
val info = sourceLine(sourceInfo, " at ", "") val info = sourceLine(sourceInfo, " at ", "")
@ -255,14 +257,16 @@ abstract class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
(x.bundleIn(iStart+j), y.bundleOut(oStart+j)) (x.bundleIn(iStart+j), y.bundleOut(oStart+j))
} }
} }
val (out, newbinding) = inner.connect(edges _, bundles _) val (out, newbinding) = inner.connect(edges _, bundles _, enableMonitoring)
LazyModule.stack.head.bindings = newbinding :: LazyModule.stack.head.bindings LazyModule.stack.head.bindings = newbinding :: LazyModule.stack.head.bindings
out out
} }
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_ONCE, true)
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_STAR, true)
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] = bind(h, BIND_QUERY, true)
def connectButDontMonitor(h: OutwardNodeHandle[DI, UI, BI])(implicit p: Parameters, sourceInfo: SourceInfo): Option[MonitorBase] = bind(h, BIND_ONCE, false)
// meta-data for printing the node graph // meta-data for printing the node graph
protected[diplomacy] def colour = inner.colour protected[diplomacy] def colour = inner.colour

View File

@ -59,8 +59,9 @@ class Frontend(val icacheParams: ICacheParams, hartid: Int, owner: => Option[Dev
val masterNode = TLOutputNode() val masterNode = TLOutputNode()
val slaveNode = TLInputNode() val slaveNode = TLInputNode()
icache.slaveNode.map { _ := slaveNode }
masterNode := icache.masterNode masterNode := icache.masterNode
// Avoid breaking tile dedup due to address constants in the monitor
icache.slaveNode.map { _ connectButDontMonitor slaveNode }
} }
class FrontendBundle(outer: Frontend) extends CoreBundle()(outer.p) { class FrontendBundle(outer: Frontend) extends CoreBundle()(outer.p) {

View File

@ -347,10 +347,9 @@ trait HasPeripheryErrorSlave extends HasSystemNetworks {
private val maxXfer = min(config.address.map(_.alignment).max.toInt, 4096) private val maxXfer = min(config.address.map(_.alignment).max.toInt, 4096)
val error = LazyModule(new TLError(config.address, peripheryBusConfig.beatBytes)) val error = LazyModule(new TLError(config.address, peripheryBusConfig.beatBytes))
// Override the default Parameters to exclude the TLMonitor between the Fragmenter and error slave. // Most slaves do not support a 4kB burst so this slave ends up with many more source bits than others;
// Most slaves do not support a 4kB burst so this slave ends up with many more source bits than others. // we exclude the onerously large TLMonitor that results.
private def sourceInfo(implicit x: chisel3.internal.sourceinfo.SourceInfo) = x error.node connectButDontMonitor TLFragmenter(peripheryBusConfig.beatBytes, maxXfer)(peripheryBus.node)
error.node.:=(TLFragmenter(peripheryBusConfig.beatBytes, maxXfer)(peripheryBus.node))(new WithoutTLMonitors ++ p, sourceInfo)
} }

View File

@ -24,8 +24,9 @@ object TLImp extends NodeImp[TLClientPortParameters, TLManagerPortParameters, TL
override def labelI(ei: TLEdgeIn) = (ei.manager.beatBytes * 8).toString override def labelI(ei: TLEdgeIn) = (ei.manager.beatBytes * 8).toString
override def labelO(eo: TLEdgeOut) = (eo.manager.beatBytes * 8).toString override def labelO(eo: TLEdgeOut) = (eo.manager.beatBytes * 8).toString
override def connect(edges: () => Seq[TLEdgeIn], bundles: () => Seq[(TLBundle, TLBundle)])(implicit p: Parameters, sourceInfo: SourceInfo): (Option[TLMonitorBase], () => Unit) = { override def connect(edges: () => Seq[TLEdgeIn], bundles: () => Seq[(TLBundle, TLBundle)], enableMonitoring: Boolean)
val monitor = p(TLMonitorBuilder)(TLMonitorArgs(edges, sourceInfo, p)) (implicit p: Parameters, sourceInfo: SourceInfo): (Option[TLMonitorBase], () => Unit) = {
val monitor = if (enableMonitoring) p(TLMonitorBuilder)(TLMonitorArgs(edges, sourceInfo, p)) else None
(monitor, () => { (monitor, () => {
val eval = bundles () val eval = bundles ()
monitor.foreach { m => (eval zip m.module.io.in) foreach { case ((i,o), m) => m := TLBundleSnoop(o,i) } } monitor.foreach { m => (eval zip m.module.io.in) foreach { case ((i,o), m) => m := TLBundleSnoop(o,i) } }