summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/Module.scala
diff options
context:
space:
mode:
authorJack Koenig2021-02-10 13:49:25 -0800
committerGitHub2021-02-10 13:49:25 -0800
commitf41e762830c5af1a92de9d8ee26e2b0de52b76ad (patch)
tree89a42cf3ae9eb96b02a54bc83040c04cd1ea294d /core/src/main/scala/chisel3/Module.scala
parent2ed343e2305b7c22000f3f46fa81d73a369907eb (diff)
parent0a0d7c6aac4326f2127d6d95efa5a4e10c81946c (diff)
Merge pull request #1624 from chipsalliance/gc-data
Make Data GC-able
Diffstat (limited to 'core/src/main/scala/chisel3/Module.scala')
-rw-r--r--core/src/main/scala/chisel3/Module.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/main/scala/chisel3/Module.scala b/core/src/main/scala/chisel3/Module.scala
index d34211f1..9f8087bf 100644
--- a/core/src/main/scala/chisel3/Module.scala
+++ b/core/src/main/scala/chisel3/Module.scala
@@ -209,6 +209,8 @@ package experimental {
*/
// TODO: seal this?
abstract class BaseModule extends HasId {
+ _parent.foreach(_.addId(this))
+
//
// Builder Internals - this tracks which Module RTL construction belongs to.
//
@@ -382,6 +384,17 @@ package experimental {
names
}
+ /** Invokes _onModuleClose on HasIds found via reflection but not bound to hardware
+ * (thus not part of _ids)
+ * This maintains old naming behavior for non-hardware Data
+ */
+ private[chisel3] def closeUnboundIds(names: HashMap[HasId, String]): Unit = {
+ val idLookup = _ids.toSet
+ for ((id, _) <- names if !idLookup(id)) {
+ id._onModuleClose
+ }
+ }
+
/** Compatibility function. Allows Chisel2 code which had ports without the IO wrapper to
* compile under Bindings checks. Does nothing in non-compatibility mode.
*