aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJack Koenig2018-07-02 17:18:32 -0700
committerGitHub2018-07-02 17:18:32 -0700
commit2b405652a266114377816b8175ef9fad7d36ed14 (patch)
tree9d126903e1fee1d05e534b75cfdfed60fcef1651 /src/test
parent4ee238fc482aab582130cc4c3bb067cc3e872ce4 (diff)
Make ZeroWidth properly rename removed empty aggregates (#839)
Fixes #756
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/AnnotationTests.scala35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/AnnotationTests.scala b/src/test/scala/firrtlTests/AnnotationTests.scala
index 9fb8dfd9..99e1ea2c 100644
--- a/src/test/scala/firrtlTests/AnnotationTests.scala
+++ b/src/test/scala/firrtlTests/AnnotationTests.scala
@@ -420,6 +420,40 @@ abstract class AnnotationTests extends AnnotationSpec with Matchers {
val y = AnnotationUtils.toNamed(x.serialize)
require(x == y)
}
+
+ "Annotations on empty aggregates" should "be deleted" in {
+ val compiler = new VerilogCompiler
+ val input =
+ """circuit Top :
+ | module Top :
+ | input x : { foo : UInt<8>, bar : {}, fizz : UInt<8>[0], buzz : UInt<0> }
+ | output y : { foo : UInt<8>, bar : {}, fizz : UInt<8>[0], buzz : UInt<0> }
+ | output a : {}
+ | output b : UInt<8>[0]
+ | y <= x
+ |""".stripMargin
+ val annos = Seq(
+ anno("x"), anno("y.bar"), anno("y.fizz"), anno("y.buzz"), anno("a"), anno("b")
+ )
+ val result = compiler.compile(CircuitState(parse(input), ChirrtlForm, annos), Nil)
+ val resultAnno = result.annotations.toSeq
+ resultAnno should contain (anno("x_foo"))
+ resultAnno should not contain (anno("a"))
+ resultAnno should not contain (anno("b"))
+ // Check both with and without dots because both are wrong
+ resultAnno should not contain (anno("y.bar"))
+ resultAnno should not contain (anno("y.fizz"))
+ resultAnno should not contain (anno("y.buzz"))
+ resultAnno should not contain (anno("x.bar"))
+ resultAnno should not contain (anno("x.fizz"))
+ resultAnno should not contain (anno("x.buzz"))
+ resultAnno should not contain (anno("y_bar"))
+ resultAnno should not contain (anno("y_fizz"))
+ resultAnno should not contain (anno("y_buzz"))
+ resultAnno should not contain (anno("x_bar"))
+ resultAnno should not contain (anno("x_fizz"))
+ resultAnno should not contain (anno("x_buzz"))
+ }
}
class LegacyAnnotationTests extends AnnotationTests {
@@ -464,6 +498,7 @@ class LegacyAnnotationTests extends AnnotationTests {
}
thrown.getMessage should include ("Illegal circuit name")
}
+
}
class JsonAnnotationTests extends AnnotationTests with BackendCompilationUtilities {