From bcbe60dec0c92b22f7aa98669cdec21c3111acd4 Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Fri, 7 Feb 2020 14:59:27 -0500 Subject: Test EliminateTargetPaths ModuleTarget anno duping Add a test that EliminateTargetPaths properly duplicates an annotation pointing at a ModuleTarget. Signed-off-by: Schuyler Eldridge --- .../annotationTests/EliminateTargetPathsSpec.scala | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/test/scala/firrtlTests/annotationTests/EliminateTargetPathsSpec.scala b/src/test/scala/firrtlTests/annotationTests/EliminateTargetPathsSpec.scala index 7aac277f..9d7df718 100644 --- a/src/test/scala/firrtlTests/annotationTests/EliminateTargetPathsSpec.scala +++ b/src/test/scala/firrtlTests/annotationTests/EliminateTargetPathsSpec.scala @@ -372,4 +372,28 @@ class EliminateTargetPathsSpec extends FirrtlPropSpec with FirrtlMatchers { .annotations .collect{ case a: firrtl.annotations.transforms.ResolvePaths => a } should be (empty) } + + property("It should rename module annotations") { + val input = + """|circuit Foo: + | module Bar: + | node x = UInt<1>(0) + | skip + | module Foo: + | inst bar of Bar""".stripMargin + val Bar_x = CircuitTarget("Foo").module("Bar").ref("x") + val output = CircuitState(passes.ToWorkingIR.run(Parser.parse(input)), UnknownForm, Seq(DontTouchAnnotation(Bar_x))) + .resolvePaths(Seq(CircuitTarget("Foo").module("Foo").instOf("bar", "Bar"))) + + info(output.circuit.serialize) + + val newBar_x = CircuitTarget("Foo").module("Bar___Foo_bar").ref("x") + + output + .annotations + .filter{ + case _: DeletedAnnotation => false + case _ => true + } should contain (DontTouchAnnotation(newBar_x)) + } } -- cgit v1.2.3