tilelink2: Nodes can now mix context into parameters
This commit is contained in:
parent
503ce14c98
commit
915a929af1
@ -17,6 +17,9 @@ abstract class NodeImp[PO, PI, EO, EI, B <: Data]
|
||||
def bundleO(eo: Seq[EO]): Vec[B]
|
||||
def bundleI(ei: Seq[EI]): Vec[B]
|
||||
def connect(bo: B, eo: EO, bi: B, ei: EI)(implicit sourceInfo: SourceInfo): Unit
|
||||
// If you want to track parameters as they flow through nodes, overload these:
|
||||
def mixO(po: PO, node: BaseNode[PO, PI, EO, EI, B]): PO = po
|
||||
def mixI(pi: PI, node: BaseNode[PO, PI, EO, EI, B]): PI = pi
|
||||
}
|
||||
|
||||
class RootNode
|
||||
@ -59,12 +62,12 @@ class BaseNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B])(
|
||||
private lazy val oParams : Seq[PO] = {
|
||||
val o = oFn(oPorts.size, iPorts.map{ case (i, n) => n.oParams(i) })
|
||||
reqE(oPorts.size, o.size)
|
||||
o
|
||||
o.map(imp.mixO(_, this))
|
||||
}
|
||||
private lazy val iParams : Seq[PI] = {
|
||||
val i = iFn(iPorts.size, oPorts.map{ case (o, n) => n.iParams(o) })
|
||||
reqE(i.size, iPorts.size)
|
||||
i
|
||||
i.map(imp.mixI(_, this))
|
||||
}
|
||||
|
||||
lazy val edgesOut = (oPorts zip oParams).map { case ((i, n), o) => imp.edgeO(o, n.iParams(i)) }
|
||||
|
Loading…
Reference in New Issue
Block a user