1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00

SuspendSimulation for better control

This commit is contained in:
jand 2003-05-09 16:27:01 +00:00
parent dd92c1b5ea
commit 5627e09fb2

View File

@ -134,10 +134,11 @@ class Simulation(object):
continue continue
elif _siglist: elif _siglist:
continue continue
if t == maxTime:
raise StopSimulation, "Simulated for duration %s" % duration
if _futureEvents: if _futureEvents:
if t == maxTime:
raise SuspendSimulation, \
"Simulated for duration %s" % duration
_futureEvents.sort() _futureEvents.sort()
t = sim._time = _futureEvents[0][0] t = sim._time = _futureEvents[0][0]
if cosim: if cosim:
@ -155,11 +156,14 @@ class Simulation(object):
else: else:
raise StopSimulation, "No more events" raise StopSimulation, "No more events"
except SuspendSimulation:
if not quiet:
printExcInfo()
return 1
except StopSimulation: except StopSimulation:
if not quiet: if not quiet:
printExcInfo() printExcInfo()
if _futureEvents:
return 1
if cosim: if cosim:
os.close(cosim._rt) os.close(cosim._rt)
os.close(cosim._wf) os.close(cosim._wf)
@ -239,6 +243,10 @@ class StopSimulation(exceptions.Exception):
""" Basic exception to stop a Simulation """ """ Basic exception to stop a Simulation """
pass pass
class SuspendSimulation(exceptions.Exception):
""" Basic exception to suspend a Simulation """
pass
class join(object): class join(object):
""" Join trigger objects to form a single trigger object. """ """ Join trigger objects to form a single trigger object. """