aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/annotations/analysis
diff options
context:
space:
mode:
authorchick2020-08-14 19:47:53 -0700
committerJack Koenig2020-08-14 19:47:53 -0700
commit6fc742bfaf5ee508a34189400a1a7dbffe3f1cac (patch)
tree2ed103ee80b0fba613c88a66af854ae9952610ce /src/main/scala/firrtl/annotations/analysis
parentb516293f703c4de86397862fee1897aded2ae140 (diff)
All of src/ formatted with scalafmt
Diffstat (limited to 'src/main/scala/firrtl/annotations/analysis')
-rw-r--r--src/main/scala/firrtl/annotations/analysis/DuplicationHelper.scala26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/scala/firrtl/annotations/analysis/DuplicationHelper.scala b/src/main/scala/firrtl/annotations/analysis/DuplicationHelper.scala
index 8f925ee7..31d13139 100644
--- a/src/main/scala/firrtl/annotations/analysis/DuplicationHelper.scala
+++ b/src/main/scala/firrtl/annotations/analysis/DuplicationHelper.scala
@@ -88,10 +88,12 @@ case class DuplicationHelper(existingModules: Set[String]) {
* @param originalOfModule original module being instantiated in originalModule
* @return
*/
- def getNewOfModule(originalModule: String,
- newModule: String,
- instance: Instance,
- originalOfModule: OfModule): OfModule = {
+ def getNewOfModule(
+ originalModule: String,
+ newModule: String,
+ instance: Instance,
+ originalOfModule: OfModule
+ ): OfModule = {
dupMap.get(originalModule) match {
case None => // No duplication, can return originalOfModule
originalOfModule
@@ -129,18 +131,18 @@ case class DuplicationHelper(existingModules: Set[String]) {
val newTops = getDuplicates(top)
newTops.map { newTop =>
val newPath = mutable.ArrayBuffer[TargetToken]()
- path.foldLeft((top, newTop)) { case ((originalModule, newModule), (instance, ofModule)) =>
- val newOfModule = getNewOfModule(originalModule, newModule, instance, ofModule)
- newPath ++= Seq(instance, newOfModule)
- (ofModule.value, newOfModule.value)
+ path.foldLeft((top, newTop)) {
+ case ((originalModule, newModule), (instance, ofModule)) =>
+ val newOfModule = getNewOfModule(originalModule, newModule, instance, ofModule)
+ newPath ++= Seq(instance, newOfModule)
+ (ofModule.value, newOfModule.value)
}
- val module = if(newPath.nonEmpty) newPath.last.value.toString else newTop
+ val module = if (newPath.nonEmpty) newPath.last.value.toString else newTop
t.notPath match {
- case Seq() => ModuleTarget(t.circuit, module)
+ case Seq() => ModuleTarget(t.circuit, module)
case Instance(i) +: OfModule(m) +: Seq() => ModuleTarget(t.circuit, module)
- case Ref(r) +: components => ReferenceTarget(t.circuit, module, Nil, r, components)
+ case Ref(r) +: components => ReferenceTarget(t.circuit, module, Nil, r, components)
}
}.toSeq
}
}
-