if value.operator == "~":
return f"(~{self(arg)})"
if value.operator == "-":
- return f"(-{self(arg)})"
+ return f"(-{sign(arg)})"
if value.operator == "b":
return f"bool({mask(arg)})"
if value.operator == "r|":
self.assertStatement(stmt, [C(0b1000000)], C(0b0000010))
self.assertStatement(stmt, [C(0b1000001)], C(0b0000110))
+
class SimulatorIntegrationTestCase(FHDLTestCase):
@contextmanager
def assertSimulation(self, module, deadline=None):
dut = Module()
dut.d.comb += Signal().eq(Repl(Const(1), 0))
Simulator(dut).run()
+
+ def test_bug_473(self):
+ sim = Simulator(Module())
+ def process():
+ self.assertEqual((yield -(Const(0b11, 2).as_signed())), 1)
+ sim.add_process(process)
+ sim.run()