sim: represent time internally as 1ps units

Using floats to represent simulation time internally isn't ideal
instead use 1ps internal units while continuing to use a floating
point based interface for compatibility.

Fixes #535.
This commit is contained in:
modwizcode 2021-12-12 21:43:20 -06:00 committed by Catherine
parent fab9fb1fea
commit 1ee2482c6b
5 changed files with 29 additions and 14 deletions

View file

@ -571,6 +571,19 @@ class SimulatorIntegrationTestCase(FHDLTestCase):
self.fail()
sim.add_process(process)
def test_run_until_fail(self):
m = Module()
s = Signal()
m.d.sync += s.eq(0)
with self.assertRaises(AssertionError):
with self.assertSimulation(m, deadline=100e-6) as sim:
sim.add_clock(1e-6)
def process():
for _ in range(99):
yield Delay(1e-6)
self.fail()
sim.add_process(process)
def test_add_process_wrong(self):
with self.assertSimulation(Module()) as sim:
with self.assertRaisesRegex(TypeError,