diff options
| author | Jack Koenig | 2020-08-26 10:36:31 -0700 |
|---|---|---|
| committer | GitHub | 2020-08-26 10:36:31 -0700 |
| commit | c9a320b00ec31bc971cba0f09d1bbf3851733c46 (patch) | |
| tree | 94aca7fa3bbe9a9d545bf19911b75357cb556342 /src/test | |
| parent | 40cb49f9237e23608da454a194f5c55e33f19375 (diff) | |
Emit parentheses in Verilog for nested unary ops (#1865)
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/VerilogEmitterTests.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/VerilogEmitterTests.scala b/src/test/scala/firrtlTests/VerilogEmitterTests.scala index 42f0bf85..0a5c2c29 100644 --- a/src/test/scala/firrtlTests/VerilogEmitterTests.scala +++ b/src/test/scala/firrtlTests/VerilogEmitterTests.scala @@ -754,6 +754,24 @@ class VerilogEmitterSpec extends FirrtlFlatSpec { result("test \uD83D\uDE0E") should containLine(" assign z = x; // @[test \\uD83D\\uDE0E]") } + + it should "emit repeated unary operators with parentheses" in { + val result1 = compileBody( + """input x : UInt<1> + |output z : UInt<1> + |z <= not(not(x)) + |""".stripMargin + ) + result1 should containLine("assign z = ~(~x);") + + val result2 = compileBody( + """input x : UInt<8> + |output z : UInt<1> + |z <= not(andr(x)) + |""".stripMargin + ) + result2 should containLine("assign z = ~(&x);") + } } class VerilogDescriptionEmitterSpec extends FirrtlFlatSpec { |
