mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
Merge pull request #145 from punkkeks/master
Add 'filename' attribute to traceSignals
This commit is contained in:
commit
8c4ae9d186
@ -90,6 +90,11 @@ Waveform tracing
|
|||||||
This attribute is used to set the directory to which VCD files are written. By
|
This attribute is used to set the directory to which VCD files are written. By
|
||||||
default, the current working directory is used.
|
default, the current working directory is used.
|
||||||
|
|
||||||
|
.. attribute:: filename
|
||||||
|
|
||||||
|
This attribute is used to set the filename to which VCD files are written. By
|
||||||
|
default, the name attribbute is used.
|
||||||
|
|
||||||
.. attribute:: timescale
|
.. attribute:: timescale
|
||||||
|
|
||||||
This attribute is used to set the timescale corresponding to unit steps,
|
This attribute is used to set the timescale corresponding to unit steps,
|
||||||
|
@ -50,6 +50,7 @@ class _TraceSignalsClass(object):
|
|||||||
|
|
||||||
__slot__ = ("name",
|
__slot__ = ("name",
|
||||||
"directory",
|
"directory",
|
||||||
|
"filename",
|
||||||
"timescale",
|
"timescale",
|
||||||
"tracelists"
|
"tracelists"
|
||||||
)
|
)
|
||||||
@ -57,6 +58,7 @@ class _TraceSignalsClass(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.name = None
|
self.name = None
|
||||||
self.directory = None
|
self.directory = None
|
||||||
|
self.filename = None
|
||||||
self.timescale = "1ns"
|
self.timescale = "1ns"
|
||||||
self.tracelists = True
|
self.tracelists = True
|
||||||
|
|
||||||
@ -89,8 +91,13 @@ class _TraceSignalsClass(object):
|
|||||||
else:
|
else:
|
||||||
directory = self.directory
|
directory = self.directory
|
||||||
|
|
||||||
|
if self.filename is None:
|
||||||
|
filename = name
|
||||||
|
else:
|
||||||
|
filename = str(self.filename)
|
||||||
|
|
||||||
h = _HierExtr(name, dut, *args, **kwargs)
|
h = _HierExtr(name, dut, *args, **kwargs)
|
||||||
vcdpath = os.path.join(directory, name + ".vcd")
|
vcdpath = os.path.join(directory, filename + ".vcd")
|
||||||
if path.exists(vcdpath):
|
if path.exists(vcdpath):
|
||||||
backup = vcdpath + '.' + str(path.getmtime(vcdpath))
|
backup = vcdpath + '.' + str(path.getmtime(vcdpath))
|
||||||
shutil.copyfile(vcdpath, backup)
|
shutil.copyfile(vcdpath, backup)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user