summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/chisel3/Data.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/main/scala/chisel3/Data.scala b/core/src/main/scala/chisel3/Data.scala
index 52cc041c..3af5ade1 100644
--- a/core/src/main/scala/chisel3/Data.scala
+++ b/core/src/main/scala/chisel3/Data.scala
@@ -265,6 +265,14 @@ package experimental {
}
}
+ /** Returns the parent module within which a module instance is instantiated
+ *
+ * @note Top-level modules in any given elaboration do not have a parent
+ * @param target a module instance
+ * @return the parent of the `target`, if one exists
+ */
+ def getParent(target: BaseModule): Option[BaseModule] = target._parent
+
// Internal reflection-style APIs, subject to change and removal whenever.
object internal {
def isSynthesizable(target: Data): Boolean = target.isSynthesizable