diplomacy: reprotect Node bundles after module construction is completed
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user