Skip to content

Instantly share code, notes, and snippets.

@cfelton
Created February 23, 2016 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfelton/5eb100592b2be16ca629 to your computer and use it in GitHub Desktop.
Save cfelton/5eb100592b2be16ca629 to your computer and use it in GitHub Desktop.
Tests that should pass with myhdl simulation pause and quit
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