diff options
| author | mergify[bot] | 2022-11-07 18:29:31 +0000 |
|---|---|---|
| committer | GitHub | 2022-11-07 18:29:31 +0000 |
| commit | 086c6806708d14ad5144ca064d4c644d0f62592d (patch) | |
| tree | 1cd3b9693f3d281ece68a0f5066181632813bdd7 /core/src/main/scala | |
| parent | 017bd6b9c96974df2a3c4f35e069d60fec001f2e (diff) | |
Add DataMirror.getParent for getting parents of Modules (#2825) (#2833)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit fce8394bb0ddc9ae0d9c6668e034e483bd6b71c5)
Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'core/src/main/scala')
| -rw-r--r-- | core/src/main/scala/chisel3/Data.scala | 8 |
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 |
