1
0

diplomacy: reprotect Node bundles after module construction is completed

This commit is contained in:
Wesley W. Terpstra 2017-11-08 15:32:45 -08:00
parent fdeed7bbb3
commit 2092cb4ec8
2 changed files with 12 additions and 1 deletions

View File

@ -165,7 +165,9 @@ sealed trait LazyModuleImpLike extends BaseModule
protected[diplomacy] def instantiate() = {
val childDangles = wrapper.children.reverse.flatMap { c =>
implicit val sourceInfo = c.info
Module(c.module).dangles
val mod = Module(c.module)
mod.finishInstantiate()
mod.dangles
}
wrapper.instantiate()
val nodeDangles = wrapper.nodes.reverse.flatMap(_.instantiate())
@ -184,6 +186,10 @@ sealed trait LazyModuleImpLike extends BaseModule
}
(auto, dangles)
}
protected[diplomacy] def finishInstantiate() {
wrapper.nodes.reverse.foreach { _.finishInstantiate() }
}
}
class LazyModuleImp(val wrapper: LazyModule) extends MultiIOModule with LazyModuleImpLike {

View File

@ -93,6 +93,7 @@ abstract class BaseNode(implicit val valName: ValName)
val serial = BaseNode.serial
BaseNode.serial = BaseNode.serial + 1
protected[diplomacy] def instantiate(): Seq[Dangle]
protected[diplomacy] def finishInstantiate(): Unit
def name = lazyModule.name + "." + valName.name
def omitGraphML = outputs.isEmpty && inputs.isEmpty
@ -387,6 +388,10 @@ sealed abstract class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
danglesOut ++ danglesIn
}
protected[diplomacy] def finishInstantiate() = {
bundlesSafeNow = false
}
// connects the outward part of a node with the inward part of this node
protected[diplomacy] def bind(h: OutwardNode[DI, UI, BI], binding: NodeBinding)(implicit p: Parameters, sourceInfo: SourceInfo) {
val x = this // x := y