diff options
| author | Albert Magyar | 2020-03-24 19:29:34 -0700 |
|---|---|---|
| committer | Albert Magyar | 2020-03-30 12:09:07 -0700 |
| commit | 954f8604dd03ab715101dbae9d9433c81255ac56 (patch) | |
| tree | 4bb334cdafe7ac43b4b182a6518e8df48bd8dd7f /src/test | |
| parent | b2ec0c378b99556503aaf6d1d7324d3e3d7c8b73 (diff) | |
Add previously failing pad(cast(lit)) example as a test case
* Previously, this test failed whenever InlineCasts was run
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/InlineCastsSpec.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/InlineCastsSpec.scala b/src/test/scala/firrtlTests/InlineCastsSpec.scala new file mode 100644 index 00000000..1bf36b33 --- /dev/null +++ b/src/test/scala/firrtlTests/InlineCastsSpec.scala @@ -0,0 +1,29 @@ +// See LICENSE for license details. + +package firrtlTests + +import firrtl.transforms.InlineCastsTransform +import firrtl.testutils.FirrtlFlatSpec + +/* + * Note: InlineCasts is still part of mverilog, so this test must both: + * - Test that the InlineCasts fix is effective given the current mverilog + * - Provide a test that will be robust if and when InlineCasts is no longer run in mverilog + * + * This is why the test passes InlineCasts as a custom transform: to future-proof it so that + * it can do real LEC against no-InlineCasts. It currently is just a sanity check that the + * emitted Verilog is legal, but it will automatically become a more meaningful test when + * InlineCasts is not run in mverilog. + */ +class InlineCastsEquivalenceSpec extends FirrtlFlatSpec { + "InlineCastsTransform" should "not produce broken Verilog" in { + val input = + s"""circuit literalsel_fir: + | module literalsel_fir: + | input i: UInt<4> + | output o: SInt<8> + | o <= pad(asSInt(UInt<2>("h1")), 8) + |""".stripMargin + firrtlEquivalenceTest(input, Seq(new InlineCastsTransform)) + } +} |
