From 15309c972cd9bc2d95437af9aef9875aa169b37e Mon Sep 17 00:00:00 2001 From: Albert Chen Date: Fri, 21 May 2021 15:27:17 -0700 Subject: 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>--- src/main/scala/firrtl/passes/Inline.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/scala/firrtl') 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 -- cgit v1.2.3