forked from m-labs/nmigen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for using non-compat Elaboratable instances with compat.f…
…hdl.verilog.convert and compat.run_simulation Fixes m-labs#344
- Loading branch information
1 parent
6e1145e
commit 995f3a1
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) |