Merge pull request #858 from antmicro/jboc/gtkwave-fix

gtkwave: fix error when prefix is empty, make treeopen optional
This commit is contained in:
enjoy-digital 2021-03-23 17:02:23 +01:00 committed by GitHub
commit 9e341544d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -52,6 +52,7 @@ class GTKWSave:
savefile: str,
dumpfile: str,
filtersdir: str = None,
treeopen: bool = True,
prefix: str = "TOP.sim."):
"""Crate savefile generator for the namespace.
@ -62,6 +63,7 @@ class GTKWSave:
self.savefile = savefile
self.dumpfile = dumpfile
self.filtersdir = filtersdir
self.treeopen = treeopen
if self.filtersdir is None:
self.filtersdir = os.path.dirname(self.savefile)
@ -71,8 +73,10 @@ class GTKWSave:
self.file = open(self.savefile, "w")
self.gtkw = GTKWSave(self.file)
self.gtkw.dumpfile(self.dumpfile)
if self.treeopen:
modules = self.prefix.rstrip(".").split(".")
for i in range(len(modules)):
if modules[i]:
self.gtkw.treeopen(".".join(modules[:i + 1]))
self.gtkw.sst_expanded(True)
return self