Created
February 23, 2016 18:55
-
-
Save cfelton/5eb100592b2be16ca629 to your computer and use it in GitHub Desktop.
Tests that should pass with myhdl simulation pause and quit
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
import myhdl | |
from myhdl import instance, delay, now | |
def test(): | |
@instance | |
def tbstim(): | |
yield delay(10) | |
print("{:<8d} ".format(now())) | |
yield delay(1000) | |
print("{:<8d} ".format(now())) | |
for _ in range(10): | |
yield delay(1000) | |
return tbstim | |
sim1 = myhdl.Simulation(test()) | |
sim1.run(1000) | |
# sim1 is "puased" | |
# try and create a second, third, forth simulation | |
for ii in range(4): | |
try: | |
another_sim = myhdl.Simulation(test()) | |
# should throw an error | |
except myhdl.SimulationError as err: | |
print(err) | |
# generating more sims should have failed | |
sim1.run(1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment