mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
signal clean-up
This commit is contained in:
parent
35f7e672c6
commit
c8a6cbc65b
@ -34,7 +34,7 @@ from inspect import currentframe, getouterframes
|
||||
from copy import deepcopy as copy
|
||||
|
||||
from myhdl import _simulator as sim
|
||||
from myhdl._simulator import _siglist, _futureEvents, now
|
||||
from myhdl._simulator import _signals, _siglist, _futureEvents, now
|
||||
from myhdl._intbv import intbv
|
||||
from myhdl._bin import bin
|
||||
|
||||
@ -140,6 +140,12 @@ class Signal(object):
|
||||
self._negedgeWaiters = _NegedgeWaiterList(self)
|
||||
self._code = ""
|
||||
self._tracing = 0
|
||||
_signals.append(self)
|
||||
|
||||
def _clear(self):
|
||||
del self._eventWaiters[:]
|
||||
del self._posedgeWaiters[:]
|
||||
del self._negedgeWaiters[:]
|
||||
|
||||
def _update(self):
|
||||
val, next = self._val, self._next
|
||||
|
@ -31,7 +31,7 @@ from sets import Set
|
||||
|
||||
from myhdl import Cosimulation, StopSimulation, _SuspendSimulation
|
||||
from myhdl import _simulator, SimulationError
|
||||
from myhdl._simulator import _siglist, _futureEvents
|
||||
from myhdl._simulator import _signals, _siglist, _futureEvents
|
||||
from myhdl._Waiter import _Waiter, _inferWaiter, _SignalWaiter,_SignalTupleWaiter
|
||||
from myhdl._util import _flatten, _printExcInfo
|
||||
from myhdl._always_comb import _AlwaysComb
|
||||
@ -82,6 +82,9 @@ class Simulation(object):
|
||||
if _simulator._tracing:
|
||||
_simulator._tracing = 0
|
||||
_simulator._tf.close()
|
||||
# clean up for potential new run with same signals
|
||||
for s in _signals:
|
||||
s._clear()
|
||||
self._finished = True
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@ __author__ = "Jan Decaluwe <jan@jandecaluwe.com>"
|
||||
__revision__ = "$Revision$"
|
||||
__date__ = "$Date$"
|
||||
|
||||
_signals = []
|
||||
_siglist = []
|
||||
_futureEvents = []
|
||||
_time = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user