aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/CompilerTests.scala
diff options
context:
space:
mode:
authorSchuyler Eldridge2019-02-05 14:57:53 -0500
committerGitHub2019-02-05 14:57:53 -0500
commitd69c609fd41c2b6ca2993085bcd2923daa563bde (patch)
tree3d7a3bacd8debc917cd5525d6fdecdee6a50e31c /src/test/scala/firrtlTests/CompilerTests.scala
parentfa0a6e2cbe2a78fc231f47b5b73d870669b54ade (diff)
parent0a88492bfbbfe7e446b74776ec59cab69e73585b (diff)
Merge pull request #1004 from seldridge/issue-423
Add "mverilog" Compiler Option, MinimumVerilogEmitter
Diffstat (limited to 'src/test/scala/firrtlTests/CompilerTests.scala')
-rw-r--r--src/test/scala/firrtlTests/CompilerTests.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/CompilerTests.scala b/src/test/scala/firrtlTests/CompilerTests.scala
index 348ed300..dc70847a 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,34 @@ 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>[3]
+ | node c = bits(UInt<3>("h7"), 2, 2)
+ | node d = shr(UInt<3>("h7"), 2)
+ | b[0] is invalid
+ | b[1] <= c
+ | b[2] <= d
+ |""".stripMargin
+ val check = """|module Top(
+ | output b_0,
+ | output b_1,
+ | output b_2
+ |);
+ | wire c;
+ | wire d;
+ | assign c = 1'h1;
+ | assign d = 1'h1;
+ | assign b_0 = 1'h0;
+ | assign b_1 = c;
+ | assign b_2 = d;
+ |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)
+ }
+}