aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJack Koenig2017-07-06 18:16:33 -0700
committerJack2017-07-17 14:23:57 -0700
commit427095ad97ac31e994fee3d083eb18f78e701004 (patch)
tree50d8b5fdd8dfc297f0727ea203ad9e15548a7bef /src/test
parent661147d84d8c27a5b4f051ced12ebf7efecb40dc (diff)
Fix ConstProp bug where multiple names would swap with one
Fixes issue in https://github.com/freechipsproject/rocket-chip/pull/848
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/ConstantPropagationTests.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ConstantPropagationTests.scala b/src/test/scala/firrtlTests/ConstantPropagationTests.scala
index 75c43cf2..380d53e5 100644
--- a/src/test/scala/firrtlTests/ConstantPropagationTests.scala
+++ b/src/test/scala/firrtlTests/ConstantPropagationTests.scala
@@ -451,6 +451,33 @@ class ConstantPropagationSpec extends FirrtlFlatSpec {
"""
(parse(exec(input))) should be (parse(check))
}
+
+ // =============================
+ "ConstProp" should "only swap a given name with one other name" in {
+ val input =
+"""circuit Top :
+ module Top :
+ input x : UInt<1>
+ input y : UInt<1>
+ output z : UInt<3>
+ node _T_1 = add(x, y)
+ node n = _T_1
+ node m = _T_1
+ z <= add(n, m)
+"""
+ val check =
+"""circuit Top :
+ module Top :
+ input x : UInt<1>
+ input y : UInt<1>
+ output z : UInt<3>
+ node n = add(x, y)
+ node _T_1 = n
+ node m = n
+ z <= add(n, n)
+"""
+ (parse(exec(input))) should be (parse(check))
+ }
}
// More sophisticated tests of the full compiler