From e40660622d39995b46c174b56f95f4d6ce3dee02 Mon Sep 17 00:00:00 2001 From: Albert Magyar Date: Thu, 30 Mar 2017 19:08:20 -0700 Subject: Find a single cycle from potentially many in a combinational SCC --- .../scala/firrtlTests/CheckCombLoopsSpec.scala | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala b/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala index 16482560..d6d4f02e 100644 --- a/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala +++ b/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala @@ -123,5 +123,28 @@ class CheckCombLoopsSpec extends SimpleTransformSpec { } } + "Multiple simple loops in one SCC" should "throw an exception" in { + val input = """circuit hasloops : + | module hasloops : + | input i : UInt<1> + | output o : UInt<1> + | wire a : UInt<1> + | wire b : UInt<1> + | wire c : UInt<1> + | wire d : UInt<1> + | wire e : UInt<1> + | a <= and(c,i) + | b <= and(a,d) + | c <= b + | d <= and(c,e) + | e <= b + | o <= e + |""".stripMargin + + val writer = new java.io.StringWriter + intercept[CheckCombLoops.CombLoopException] { + compile(CircuitState(parse(input), ChirrtlForm, None), writer) + } + } } -- cgit v1.2.3