From 0b1391a623ee0769dc51fce15e0e0f5516225d5d Mon Sep 17 00:00:00 2001 From: Kevin Laeufer Date: Fri, 28 Aug 2020 13:15:56 -0700 Subject: FlattenSpec: flattening a module with no instaces should be a no-op (#1868) * FlattenSpec: flattening a module with no instaces should be a no-op * Fix problem when flattening/inlining a lone module Fix an edge case bug in InlineInstances where a circuit containing a lone module is flattened/inlined. This now properly special cases the situation of an empty indexMap which before had to be of length >= 1. Signed-off-by: Schuyler Eldridge * Simplify rename logic in InlineInstances Co-authored-by: Jack Koenig Co-authored-by: Albert Magyar Signed-off-by: Schuyler Eldridge * Mea culpa Signed-off-by: Schuyler Eldridge Co-authored-by: Schuyler Eldridge Co-authored-by: Jack Koenig Co-authored-by: Albert Magyar --- src/test/scala/firrtlTests/FlattenTests.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/firrtlTests/FlattenTests.scala b/src/test/scala/firrtlTests/FlattenTests.scala index 53604ee5..ef555eaa 100644 --- a/src/test/scala/firrtlTests/FlattenTests.scala +++ b/src/test/scala/firrtlTests/FlattenTests.scala @@ -272,4 +272,16 @@ class FlattenTests extends LowTransformSpec { """.stripMargin execute(input, check, Seq(flatten("Top"))) } + + "The Flatten transform" should "work on modules with no instances" in { + val input = """ + |circuit Top : + | module Top : + | input a : UInt<32> + | output b : UInt<32> + | b <= a + """.stripMargin + val check = input + execute(input, check, Seq(flatten("Top"))) + } } -- cgit v1.2.3