diff --git a/myhdl/test/bugs/test_issue_169.py b/myhdl/test/bugs/test_issue_169.py new file mode 100644 index 00000000..905decd7 --- /dev/null +++ b/myhdl/test/bugs/test_issue_169.py @@ -0,0 +1,56 @@ +from myhdl import Signal, block, delay, instance + +import pytest + + +class Test1: + def __init__(self): + self.clock = Signal(bool(0)) + + @block + def test(self): + + @instance + def func(): + while True: + yield delay(10) + self.clock.next = not self.clock + + return func + + +class Test2: + def __init__(self): + self.clock = Signal(bool(1)) + + @block + def test(self): + + @instance + def func(): + while True: + yield delay(10) + self.clock.next = not self.clock + + return func + + +@block +def test_bench(): + inst1 = Test1() + inst2 = Test2() + + # Two instances are created + ins1 = inst1.test() + ins2 = inst2.test() + + return ins1, ins2 + +@pytest.mark.xfail +def test_issue_169(): + test_inst = testbench() + assert test_inst.verify_convert() == 0 + +if __name__ == '__main__': + test_issue_169() +