diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/resources/features/HasLoops.fir | 9 | ||||
| -rw-r--r-- | src/test/scala/firrtlTests/CheckCombLoopsSpec.scala | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/resources/features/HasLoops.fir b/src/test/resources/features/HasLoops.fir new file mode 100644 index 00000000..e238761d --- /dev/null +++ b/src/test/resources/features/HasLoops.fir @@ -0,0 +1,9 @@ +circuit HasLoops : + module HasLoops : + input i : UInt<1> + output o : UInt<1> + wire a : UInt<1> + wire b : UInt<1> + a <= and(b,i) + b <= not(a) + o <= add(a, UInt(1)) diff --git a/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala b/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala index dfb61843..2c12d4ca 100644 --- a/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala +++ b/src/test/scala/firrtlTests/CheckCombLoopsSpec.scala @@ -8,6 +8,8 @@ import firrtl.passes._ import firrtl.transforms._ import firrtl.Mappers._ import annotations._ +import java.io.File +import java.nio.file.Paths class CheckCombLoopsSpec extends SimpleTransformSpec { @@ -147,5 +149,22 @@ class CheckCombLoopsSpec extends SimpleTransformSpec { compile(CircuitState(parse(input), ChirrtlForm, None), writer) } } +} + +class CheckCombLoopsCommandLineSpec extends FirrtlFlatSpec { + val testDir = createTestDirectory("CombLoopChecker") + val inputFile = Paths.get(getClass.getResource("/features/HasLoops.fir").toURI()).toFile() + val outFile = new File(testDir, "HasLoops.v") + val args = Array("-i", inputFile.getAbsolutePath, "-o", outFile.getAbsolutePath, "-X", "verilog") + + "Combinational loops detection" should "run by default" in { + a [CheckCombLoops.CombLoopException] should be thrownBy { + firrtl.Driver.execute(args) + } + } + + it should "not run when given --no-check-comb-loops option" in { + firrtl.Driver.execute(args :+ "--no-check-comb-loops") + } } |
