diff options
| author | Schuyler Eldridge | 2020-01-15 17:12:53 -0500 |
|---|---|---|
| committer | mergify[bot] | 2020-01-15 22:12:53 +0000 |
| commit | 6b21b7df6f70ed753abe03814c88ef9010259303 (patch) | |
| tree | 691d1db42444b6d751e7f5bc9d4e1c570977495a /src/main | |
| parent | 16acdc39291b8e35548e22ebaabb036da847de37 (diff) | |
Filter ResolvePaths in EliminateTargetPaths (#1310)
Change EliminateTargetPaths to remove ResolvePaths annotations in the
output AnnotationSeq. This prevents a bug whereby the upstream
ResolvePaths annotations from previous runs of EliminateTargetPaths
can result in unexpected duplication.
Adds a test that checks that ResolvePaths annotations are actually
removed.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/annotations/transforms/EliminateTargetPaths.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/scala/firrtl/annotations/transforms/EliminateTargetPaths.scala b/src/main/scala/firrtl/annotations/transforms/EliminateTargetPaths.scala index f6bab6ea..2f20430b 100644 --- a/src/main/scala/firrtl/annotations/transforms/EliminateTargetPaths.scala +++ b/src/main/scala/firrtl/annotations/transforms/EliminateTargetPaths.scala @@ -133,10 +133,13 @@ class EliminateTargetPaths extends Transform { override protected def execute(state: CircuitState): CircuitState = { - val annotations = state.annotations.collect { case a: ResolvePaths => a } + val (annotations, annotationsx) = state.annotations.partition{ + case a: ResolvePaths => true + case _ => false + } // Collect targets that are not local - val targets = annotations.flatMap(_.targets.collect { case x: IsMember => x }) + val targets = annotations.map(_.asInstanceOf[ResolvePaths]).flatMap(_.targets.collect { case x: IsMember => x }) // Check validity of paths in targets val instanceOfModules = new InstanceGraph(state.circuit).getChildrenInstanceOfModule @@ -162,6 +165,6 @@ class EliminateTargetPaths extends Transform { val (newCircuit, renameMap) = run(state.circuit, targets) - state.copy(circuit = newCircuit, renames = Some(renameMap)) + state.copy(circuit = newCircuit, renames = Some(renameMap), annotations = annotationsx) } } |
