diff options
| author | Schuyler Eldridge | 2019-01-25 14:04:16 -0500 |
|---|---|---|
| committer | Schuyler Eldridge | 2019-02-05 14:09:42 -0500 |
| commit | 334c9bbe5061a3bcb72df971ec555de7df0ba36c (patch) | |
| tree | ac57432a334a14b777ca773a95d260b3d6660c81 /src/test | |
| parent | fa0a6e2cbe2a78fc231f47b5b73d870669b54ade (diff) | |
Add "mverilog" Compiler Option, Compiler Fixes
This adds "mverilog" to the "--compiler" command line option. This
will run the MinimumVerilogCompiler.
This additionally fixes the MinimumVerilogCompiler such that
DeadCodeElimination will not be run (it's not supposed to be). This is
done by adding a MinimumVerilogEmitter, subclassing VerilogVerilog,
that strips the DeadCodeElimination step from its parent.
Additionally, BlackBoxSourceHelper is removed from the
MinimumVerilogCompiler since this will be run by the VerilogEmitter
already.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/CompilerTests.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/CompilerTests.scala b/src/test/scala/firrtlTests/CompilerTests.scala index 348ed300..ff7d2cb8 100644 --- a/src/test/scala/firrtlTests/CompilerTests.scala +++ b/src/test/scala/firrtlTests/CompilerTests.scala @@ -13,6 +13,7 @@ import firrtl.{ Compiler, HighFirrtlCompiler, MiddleFirrtlCompiler, + MinimumVerilogCompiler, LowFirrtlCompiler, Parser, VerilogCompiler @@ -153,3 +154,31 @@ class VerilogCompilerSpec extends CompilerSpec with Matchers { getOutput should be (check) } } + +class MinimumVerilogCompilerSpec extends CompilerSpec with Matchers { + val input = """|circuit Top: + | module Top: + | output b: UInt<1>[2] + | node c = UInt<1>("h0") + | node d = UInt<1>("h0") + | b[0] <= UInt<1>("h0") + | b[1] <= c + |""".stripMargin + val check = """|module Top( + | output b_0, + | output b_1 + |); + | wire c; + | wire d; + | assign c = 1'h0; + | assign d = 1'h0; + | assign b_0 = 1'h0; + | assign b_1 = c; + |endmodule + |""".stripMargin + def compiler = new MinimumVerilogCompiler() + + "A circuit's minimum Verilog output" should "not have constants propagated or dead code eliminated" in { + getOutput should be (check) + } +} |
