Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Have Flatten & InlineInstances remove their annotations #2374

Merged
merged 2 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/scala/firrtl/passes/Inline.scala
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ class InlineInstances extends Transform with DependencyAPIMigration with Registe

val renames = renamesSeq.reduceLeftOption(_ andThen _)

CircuitState(flatCircuit, LowForm, annos, renames)
val cleanedAnnos = annos.filterNot {
case InlineAnnotation(_) => true
case _ => false
}

CircuitState(flatCircuit, LowForm, cleanedAnnos, renames)
}
}
9 changes: 8 additions & 1 deletion src/main/scala/firrtl/transforms/Flatten.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ class Flatten extends Transform with DependencyAPIMigration {
val (modNames, instNames) = collectAnns(state.circuit, myAnnotations)
// take incoming annotation and produce annotations for InlineInstances, i.e. traverse circuit down to find all instances to inline
val (newc, modsToInline) = duplicateSubCircuitsFromAnno(state.circuit, modNames, instNames)
inlineTransform.run(newc, modsToInline.toSet, Set.empty[ComponentName], state.annotations)
val flattenedState = inlineTransform.run(newc, modsToInline.toSet, Set.empty[ComponentName], state.annotations)

val cleanedAnnos = flattenedState.annotations.filterNot {
case FlattenAnnotation(_) => true
case _ => false
}

flattenedState.copy(annotations = cleanedAnnos)
}
}
}