From ea6cba2f404d909e10fc944d4ddb068e163f7833 Mon Sep 17 00:00:00 2001 From: Marcel Hellwig <1hellwig@informatik.uni-hamburg.de> Date: Sat, 30 Jan 2016 20:17:01 +0100 Subject: [PATCH 1/4] Add 'filename' attribute to traceSignals --- doc/source/manual/reference.rst | 5 +++++ myhdl/_traceSignals.py | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/source/manual/reference.rst b/doc/source/manual/reference.rst index 38ce3afa..f3842684 100644 --- a/doc/source/manual/reference.rst +++ b/doc/source/manual/reference.rst @@ -90,6 +90,11 @@ Waveform tracing This attribute is used to set the directory to which VCD files are written. By 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 This attribute is used to set the timescale corresponding to unit steps, diff --git a/myhdl/_traceSignals.py b/myhdl/_traceSignals.py index abd8dd5a..15f71324 100644 --- a/myhdl/_traceSignals.py +++ b/myhdl/_traceSignals.py @@ -50,6 +50,7 @@ class _TraceSignalsClass(object): __slot__ = ("name", "directory", + "filename", "timescale", "tracelists" ) @@ -57,6 +58,7 @@ class _TraceSignalsClass(object): def __init__(self): self.name = None self.directory = None + self.filename = None self.timescale = "1ns" self.tracelists = True @@ -89,8 +91,13 @@ class _TraceSignalsClass(object): else: directory = self.directory + if self.filename is None: + filename = self.name + else + filename = self.filename + h = _HierExtr(name, dut, *args, **kwargs) - vcdpath = os.path.join(directory, name + ".vcd") + vcdpath = os.path.join(directory, filename + ".vcd") if path.exists(vcdpath): backup = vcdpath + '.' + str(path.getmtime(vcdpath)) shutil.copyfile(vcdpath, backup) From 02c4f92ff69f6f0f2950de16f024654f95859ddb Mon Sep 17 00:00:00 2001 From: Marcel Hellwig <1hellwig@informatik.uni-hamburg.de> Date: Sat, 30 Jan 2016 21:26:46 +0100 Subject: [PATCH 2/4] fixed missing colon in _traceSignals --- myhdl/_traceSignals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myhdl/_traceSignals.py b/myhdl/_traceSignals.py index 15f71324..37661b20 100644 --- a/myhdl/_traceSignals.py +++ b/myhdl/_traceSignals.py @@ -93,7 +93,7 @@ class _TraceSignalsClass(object): if self.filename is None: filename = self.name - else + else: filename = self.filename h = _HierExtr(name, dut, *args, **kwargs) From cff6f1e54e1efb5d1d29d89e9fc5c2d45ab5498b Mon Sep 17 00:00:00 2001 From: Marcel Hellwig <1hellwig@informatik.uni-hamburg.de> Date: Sat, 30 Jan 2016 21:44:46 +0100 Subject: [PATCH 3/4] replaced self.name with name in _traceSignals --- myhdl/_traceSignals.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/myhdl/_traceSignals.py b/myhdl/_traceSignals.py index 37661b20..b2e16745 100644 --- a/myhdl/_traceSignals.py +++ b/myhdl/_traceSignals.py @@ -92,12 +92,12 @@ class _TraceSignalsClass(object): directory = self.directory if self.filename is None: - filename = self.name + filename = name else: - filename = self.filename + filename = str(self.filename) h = _HierExtr(name, dut, *args, **kwargs) - vcdpath = os.path.join(directory, filename + ".vcd") + vcdpath = os.path.join(directory, name + ".vcd") if path.exists(vcdpath): backup = vcdpath + '.' + str(path.getmtime(vcdpath)) shutil.copyfile(vcdpath, backup) From 04b9935626cc04a74aa3046cc836723496efd611 Mon Sep 17 00:00:00 2001 From: Marcel Hellwig <1hellwig@informatik.uni-hamburg.de> Date: Sun, 31 Jan 2016 01:10:05 +0100 Subject: [PATCH 4/4] fixed mistake where I replaced filename with name --- myhdl/_traceSignals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myhdl/_traceSignals.py b/myhdl/_traceSignals.py index b2e16745..df4cc4ec 100644 --- a/myhdl/_traceSignals.py +++ b/myhdl/_traceSignals.py @@ -97,7 +97,7 @@ class _TraceSignalsClass(object): filename = str(self.filename) h = _HierExtr(name, dut, *args, **kwargs) - vcdpath = os.path.join(directory, name + ".vcd") + vcdpath = os.path.join(directory, filename + ".vcd") if path.exists(vcdpath): backup = vcdpath + '.' + str(path.getmtime(vcdpath)) shutil.copyfile(vcdpath, backup)