diff options
| author | Andrew Waterman | 2019-01-23 13:27:19 -0800 |
|---|---|---|
| committer | Adam Izraelevitz | 2019-01-23 13:27:19 -0800 |
| commit | 1738c1ef0ac95fae25d52586b3b0348de80de2ff (patch) | |
| tree | e28d770a8ad05b7f9635365248ee6a44a766714e /src/test | |
| parent | df3c3fb5eedd3e2ac95b9f210268e4e515d6344c (diff) | |
Improve Shl codegen; eliminate Shlw WIR node (#994)
* Improve Shl codegen; eliminate Shlw WIR node
If we emit shl(x, k) as {x, k'h0} instead of (x << k), then there's
no need for Verilog-specific padding in the PadWidths pass. Avoiding
the redundant padding improves compiler/simulator performance and
renders Shlw unnecessary.
* [skip formal checks] Add test
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/UnitTests.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/UnitTests.scala b/src/test/scala/firrtlTests/UnitTests.scala index 2cf9c001..b3af920c 100644 --- a/src/test/scala/firrtlTests/UnitTests.scala +++ b/src/test/scala/firrtlTests/UnitTests.scala @@ -437,4 +437,16 @@ class UnitTests extends FirrtlFlatSpec { result should containTree { case Connect(_, `out`, mgen) => true } } + + "Shl" should "be emitted in Verilog as concat" in { + val input = + """circuit Unit : + | module Unit : + | input in : UInt<4> + | output out : UInt<8> + | out <= shl(in, 4) + |""".stripMargin + val res = (new VerilogCompiler).compileAndEmit(CircuitState(parse(input), ChirrtlForm)) + res should containLine ("assign out = {in, 4'h0};") + } } |
