diff options
| author | Albert Chen | 2021-05-21 15:27:17 -0700 |
|---|---|---|
| committer | GitHub | 2021-05-21 22:27:17 +0000 |
| commit | 15309c972cd9bc2d95437af9aef9875aa169b37e (patch) | |
| tree | 0b9e0830c0febddc846dedc515ecc507168324b9 /src/main | |
| parent | d35248c8efc8c7afb1b99ddea631be5e6537d46d (diff) | |
Fix renaming of local targets in InlineInstances (#2238)
* add more inline renaming test cases
* InlineInstances: fix renaming for local targets
* run scalafmt
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/passes/Inline.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/passes/Inline.scala b/src/main/scala/firrtl/passes/Inline.scala index 912acf8e..78b3ce36 100644 --- a/src/main/scala/firrtl/passes/Inline.scala +++ b/src/main/scala/firrtl/passes/Inline.scala @@ -179,7 +179,7 @@ class InlineInstances extends Transform with DependencyAPIMigration with Registe /** Add a prefix to all declarations updating a [[Namespace]] and appending to a [[RenameMap]] */ def appendNamePrefix( - currentModule: IsModule, + currentModule: InstanceTarget, nextModule: IsModule, prefix: String, ns: Namespace, @@ -197,8 +197,13 @@ class InlineInstances extends Transform with DependencyAPIMigration with Registe } ofModuleOpt match { case None => + renameMap.record(currentModule.ofModuleTarget.ref(name), nextModule.ref(prefix + name)) renameMap.record(currentModule.ref(name), nextModule.ref(prefix + name)) case Some(ofModule) => + renameMap.record( + currentModule.ofModuleTarget.instOf(name, ofModule), + nextModule.instOf(prefix + name, ofModule) + ) renameMap.record(currentModule.instOf(name, ofModule), nextModule.instOf(prefix + name, ofModule)) } renames(name) = prefix + name @@ -348,7 +353,6 @@ class InlineInstances extends Transform with DependencyAPIMigration with Registe .map(appendRefPrefix(inlineTarget, prefixMap)) renames.record(inlineTarget, currentModule) - renamedBody case sx => sx |
