Skip to content

Commit c28536f

Browse files
committed
Fix issue with changing vcd file name multiple times
We were seeing a bug where if you ran a bunch of tests with --dump-vcd PyMTL3 would only dump the VCD for the first test, although every once and a while it would indeed dump VCD files for the every test. This seems to have something to do with the shared library. The cleanest fix seems to be to avoid hard coding the VCD file name in the generated PyMTL wrapper and instead to dynamically get the VCD file name from the metadata.
1 parent d20ec4d commit c28536f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pymtl3/passes/backends/verilog/import_/verilator_wrapper_py_template.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
1919
from pymtl3.datatypes import *
2020
from pymtl3.dsl import Component, connect, InPort, OutPort, Wire, update, update_ff
21+
from pymtl3.passes.backends.verilog import *
2122
2223
#-------------------------------------------------------------------------
2324
# {component_name}
@@ -124,9 +125,9 @@ def __del__( s ):
124125
def construct( s, *args, **kwargs ):
125126
# Set up the VCD file name
126127
verilator_vcd_file = ""
127-
if {dump_vcd}:
128-
if {has_vl_trace_filename}:
129-
verilator_vcd_file = "{vl_trace_filename}.verilator1.vcd"
128+
if s.has_metadata( VerilogVerilatorImportPass.vl_trace ):
129+
if s.has_metadata( VerilogVerilatorImportPass.vl_trace_filename ):
130+
verilator_vcd_file = f"{{s.has_metadata(VerilogVerilatorImportPass.vl_trace_filename)}}.verilator1.vcd"
130131
else:
131132
verilator_vcd_file = "{component_name}.verilator1.vcd"
132133

0 commit comments

Comments
 (0)