From 4ee238fc482aab582130cc4c3bb067cc3e872ce4 Mon Sep 17 00:00:00 2001 From: Albert Magyar Date: Thu, 28 Jun 2018 22:15:28 -0700 Subject: Make CheckCombLoops find combinational nodes with self-edges (#837) --- src/test/scala/firrtlTests/CheckCombLoopsSpec.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/test/scala') diff --git a/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala b/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala index 06cbb8e4..d09b4d06 100644 --- a/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala +++ b/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala @@ -70,6 +70,21 @@ class CheckCombLoopsSpec extends SimpleTransformSpec { } } + "Single-element combinational loop" should "throw an exception" in { + val input = """circuit loop : + | module loop : + | output y : UInt<8> + | wire w : UInt<8> + | w <= w + | y <= w + |""".stripMargin + + val writer = new java.io.StringWriter + intercept[CheckCombLoops.CombLoopException] { + compile(CircuitState(parse(input), ChirrtlForm), writer) + } + } + "Node combinational loop" should "throw an exception" in { val input = """circuit hasloops : | module hasloops : -- cgit v1.2.3