mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
Merge pull request #252 from NicoPy/patch-3
Adds full simulation configuration
This commit is contained in:
commit
0664ab3e0b
@ -341,10 +341,12 @@ class _Block(object):
|
|||||||
setattr(converter, k, v)
|
setattr(converter, k, v)
|
||||||
return converter(self)
|
return converter(self)
|
||||||
|
|
||||||
def config_sim(self, trace=False, timescale='1ns'):
|
def config_sim(self, trace=False, **kwargs) :
|
||||||
self._config_sim['trace'] = trace
|
self._config_sim['trace'] = trace
|
||||||
if trace:
|
if trace:
|
||||||
myhdl.traceSignals(self, timescale=timescale)
|
for k, v in kwargs.items() :
|
||||||
|
setattr(myhdl.traceSignals, k, v)
|
||||||
|
myhdl.traceSignals(self)
|
||||||
|
|
||||||
def run_sim(self, duration=None, quiet=0):
|
def run_sim(self, duration=None, quiet=0):
|
||||||
if self.sim is None:
|
if self.sim is None:
|
||||||
|
@ -56,7 +56,8 @@ class _TraceSignalsClass(object):
|
|||||||
"directory",
|
"directory",
|
||||||
"filename",
|
"filename",
|
||||||
"timescale",
|
"timescale",
|
||||||
"tracelists"
|
"tracelists",
|
||||||
|
"tracebackup"
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -65,11 +66,10 @@ class _TraceSignalsClass(object):
|
|||||||
self.filename = None
|
self.filename = None
|
||||||
self.timescale = "1ns"
|
self.timescale = "1ns"
|
||||||
self.tracelists = True
|
self.tracelists = True
|
||||||
|
self.tracebackup = True
|
||||||
|
|
||||||
def __call__(self, dut, *args, **kwargs):
|
def __call__(self, dut, *args, **kwargs):
|
||||||
global _tracing, vcdpath
|
global _tracing, vcdpath
|
||||||
if 'timescale' in kwargs:
|
|
||||||
self.timescale = kwargs['timescale']
|
|
||||||
if isinstance(dut, _Block):
|
if isinstance(dut, _Block):
|
||||||
# now we go bottom-up: so clean up and start over
|
# now we go bottom-up: so clean up and start over
|
||||||
# TODO: consider a warning for the overruled block
|
# TODO: consider a warning for the overruled block
|
||||||
@ -124,6 +124,7 @@ class _TraceSignalsClass(object):
|
|||||||
vcdpath = os.path.join(directory, filename + ".vcd")
|
vcdpath = os.path.join(directory, filename + ".vcd")
|
||||||
|
|
||||||
if path.exists(vcdpath):
|
if path.exists(vcdpath):
|
||||||
|
if self.tracebackup :
|
||||||
backup = vcdpath[:-4] + '.' + str(path.getmtime(vcdpath)) + '.vcd'
|
backup = vcdpath[:-4] + '.' + str(path.getmtime(vcdpath)) + '.vcd'
|
||||||
shutil.copyfile(vcdpath, backup)
|
shutil.copyfile(vcdpath, backup)
|
||||||
os.remove(vcdpath)
|
os.remove(vcdpath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user