sim: raise an exception on add_clock conflict with comb driver.

This commit is contained in:
Wanda 2024-06-14 19:34:19 +02:00 committed by Catherine
parent 66ad0a207e
commit f5a8c07d54
2 changed files with 13 additions and 0 deletions

View file

@ -1497,6 +1497,15 @@ class SimulatorRegressionTestCase(FHDLTestCase):
sim.add_testbench(testbench)
sim.run()
def test_comb_clock_conflict(self):
c = Signal()
m = Module()
m.d.comb += ClockSignal().eq(c)
sim = Simulator(m)
with self.assertRaisesRegex(DriverConflict,
r"^Clock signal is already driven by combinational logic$"):
sim.add_clock(1e-6)
def test_sample(self):
m = Module()
m.domains.sync = cd_sync = ClockDomain()