aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAlbert Magyar2019-02-25 12:07:02 -0800
committerGitHub2019-02-25 12:07:02 -0800
commit99a0037756debbfda1843f84f19e792807777e13 (patch)
tree828df1420639988b870405e12f0e9db578dab63e /src/test
parenta7a0cad04f912303624ec7905303d53d23abbf20 (diff)
Detect and error on registers with flip in type (#1031)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/CheckSpec.scala22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala
index 3e6b19f9..af16ec03 100644
--- a/src/test/scala/firrtlTests/CheckSpec.scala
+++ b/src/test/scala/firrtlTests/CheckSpec.scala
@@ -10,7 +10,7 @@ import firrtl.ir.Circuit
import firrtl.passes.{Pass,ToWorkingIR,CheckHighForm,ResolveKinds,InferTypes,CheckTypes,PassException,InferWidths,CheckWidths,ResolveGenders,CheckGenders}
class CheckSpec extends FlatSpec with Matchers {
- "Connecting bundles of different types" should "throw an exception" in {
+ "Memories with flip in the data type" should "throw an exception" in {
val passes = Seq(
ToWorkingIR,
CheckHighForm)
@@ -28,6 +28,26 @@ class CheckSpec extends FlatSpec with Matchers {
}
}
}
+
+ "Registers with flip in the type" should "throw an exception" in {
+ val passes = Seq(
+ ToWorkingIR,
+ CheckHighForm)
+ val input =
+ """circuit Unit :
+ | module Unit :
+ | input clk : Clock
+ | input in : UInt<32>
+ | output out : UInt<32>
+ | reg r : {a : UInt<32>, flip b : UInt<32>}, clk
+ | out <= in""".stripMargin
+ intercept[CheckHighForm.RegWithFlipException] {
+ passes.foldLeft(Parser.parse(input.split("\n").toIterator)) {
+ (c: Circuit, p: Pass) => p.run(c)
+ }
+ }
+ }
+
"Instance loops a -> b -> a" should "be detected" in {
val passes = Seq(
ToWorkingIR,