From adf66019948afc46f8818e6883f1bab4d200265d Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 7 Aug 2018 14:21:38 -0700 Subject: Make RemoveWires properly include registers in dependency graph Fixes a bug where registers could be instantiated after nodes that referred to them Also add WRef.apply utility for nodes --- src/test/scala/firrtlTests/RemoveWiresSpec.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/firrtlTests/RemoveWiresSpec.scala b/src/test/scala/firrtlTests/RemoveWiresSpec.scala index f162f32c..d15e6908 100644 --- a/src/test/scala/firrtlTests/RemoveWiresSpec.scala +++ b/src/test/scala/firrtlTests/RemoveWiresSpec.scala @@ -150,4 +150,19 @@ class RemoveWiresSpec extends FirrtlFlatSpec { val names = orderedNames(result.circuit) names should be (Seq("a", "clock2", "b")) } + + it should "order registers correctly" in { + val result = compileBody(s""" + |input clock : Clock + |input a : UInt<8> + |output c : UInt<8> + |wire w : UInt<8> + |node n = tail(add(w, UInt(1)), 1) + |reg r : UInt<8>, clock + |w <= tail(add(r, a), 1) + |c <= n""".stripMargin + ) + // Check declaration before use is maintained + passes.CheckHighForm.execute(result) + } } -- cgit v1.2.3