diff options
| author | Jack Koenig | 2017-06-21 09:35:15 -0700 |
|---|---|---|
| committer | Jack Koenig | 2017-06-21 10:18:20 -0700 |
| commit | 5135e9c6aeb1c9d472a5b29adb44a4acaf504fb8 (patch) | |
| tree | baa097e2bae57ac8f15e95793e5d53b170f1a656 /src/test/scala | |
| parent | 4613ad2b519ae85fbab89e58d3304cf455514552 (diff) | |
Add --no-dce command-line option to skip DCE
Diffstat (limited to 'src/test/scala')
| -rw-r--r-- | src/test/scala/firrtlTests/DCETests.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/DCETests.scala b/src/test/scala/firrtlTests/DCETests.scala index 129460e1..41edfa8b 100644 --- a/src/test/scala/firrtlTests/DCETests.scala +++ b/src/test/scala/firrtlTests/DCETests.scala @@ -9,6 +9,9 @@ import firrtl.transforms._ import firrtl.annotations._ import firrtl.passes.memlib.SimpleTransform +import java.io.File +import java.nio.file.Paths + class DCETests extends FirrtlFlatSpec { // Not using executeTest because it is for positive testing, we need to check that stuff got // deleted @@ -387,3 +390,27 @@ class DCETests extends FirrtlFlatSpec { exec(input, check) } } + +class DCECommandLineSpec extends FirrtlFlatSpec { + + val testDir = createTestDirectory("dce") + val inputFile = Paths.get(getClass.getResource("/features/HasDeadCode.fir").toURI()).toFile() + val outFile = new File(testDir, "HasDeadCode.v") + val args = Array("-i", inputFile.getAbsolutePath, "-o", outFile.getAbsolutePath, "-X", "verilog") + + "Dead Code Elimination" should "run by default" in { + firrtl.Driver.execute(args) match { + case FirrtlExecutionSuccess(_, verilog) => + verilog should not include regex ("wire +a;") + case _ => fail("Unexpected compilation failure") + } + } + + it should "not run when given --no-dce option" in { + firrtl.Driver.execute(args :+ "--no-dce") match { + case FirrtlExecutionSuccess(_, verilog) => + verilog should include regex ("wire +a;") + case _ => fail("Unexpected compilation failure") + } + } +} |
