Add support for using non-compat Elaboratable instances with compat.fhdl.verilog.convert and compat.run_simulation
Fixes #344
This commit is contained in:
parent
6e1145e2e7
commit
995f3a147b
3 changed files with 36 additions and 2 deletions
26
nmigen/test/compat/test_run_simulation.py
Normal file
26
nmigen/test/compat/test_run_simulation.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import unittest
|
||||
from ... import Signal, Module, Elaboratable
|
||||
from .support import SimCase
|
||||
|
||||
|
||||
class RunSimulation(SimCase, unittest.TestCase):
|
||||
""" test for https://github.com/nmigen/nmigen/issues/344 """
|
||||
|
||||
class TestBench(Elaboratable):
|
||||
def __init__(self):
|
||||
self.a = Signal()
|
||||
|
||||
def elaborate(self, platform):
|
||||
m = Module()
|
||||
m.d.sync += self.a.eq(~self.a)
|
||||
return m
|
||||
|
||||
def test_run_simulation(self):
|
||||
def gen():
|
||||
yield
|
||||
for i in range(10):
|
||||
yield
|
||||
a = (yield self.tb.a)
|
||||
self.assertEqual(a, i % 2)
|
||||
|
||||
self.run_with(gen())
|
||||
Loading…
Add table
Add a link
Reference in a new issue