aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJack Koenig2018-08-07 14:21:38 -0700
committerJack Koenig2018-08-07 14:36:06 -0700
commitadf66019948afc46f8818e6883f1bab4d200265d (patch)
tree5a1286c11553d73541ef2b92ea7ee4d88afd1ca7 /src/test
parentb84cb05faba6d787cb599fac4ea687ce4249ef1d (diff)
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
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/RemoveWiresSpec.scala15
1 files changed, 15 insertions, 0 deletions
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)
+ }
}