From b435704d9fd6797d1dadb54c4a5afc839942a885 Mon Sep 17 00:00:00 2001 From: pp482 Date: Mon, 23 Oct 2023 17:15:01 -0400 Subject: [PATCH] [import] Release line trace string at final --- .../import_/verilator_wrapper_py_template.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pymtl3/passes/backends/verilog/import_/verilator_wrapper_py_template.py b/pymtl3/passes/backends/verilog/import_/verilator_wrapper_py_template.py index cbb29f5dd..d235b6451 100644 --- a/pymtl3/passes/backends/verilog/import_/verilator_wrapper_py_template.py +++ b/pymtl3/passes/backends/verilog/import_/verilator_wrapper_py_template.py @@ -82,7 +82,7 @@ def finalize( s ): s._finalization_count += 1 # Clean up python side FFI references - # del s._line_trace_str + del s._line_trace_str s._ffi_inst.destroy_model( s._ffi_m ) s.ffi.dlclose( s._ffi_inst ) @@ -95,7 +95,7 @@ def __del__( s ): s._finalization_count += 1 # Clean up python side FFI references - # del s._line_trace_str + del s._line_trace_str s._ffi_inst.destroy_model( s._ffi_m ) s.ffi.dlclose( s._ffi_inst ) @@ -123,8 +123,8 @@ def construct( s, *args, **kwargs ): s._ffi_m = s._ffi_inst.create_model( ffi_vl_vcd_file ) # Buffer for line tracing - # s._line_trace_str = s.ffi.new('char[512]') - # s._convert_string = s.ffi.string + s._line_trace_str = s.ffi.new('char[512]') + s._convert_string = s.ffi.string # Use non-attribute varialbe to reduce CPython bytecode count _ffi_m = s._ffi_m @@ -168,9 +168,8 @@ def assert_en( s, en ): def line_trace( s ): if {external_trace}: - # s._ffi_inst.trace( s._ffi_m, s._line_trace_str ) - # return s._convert_string( s._line_trace_str ).decode('ascii') - print('no implemented') + s._ffi_inst.trace( s._ffi_m, s._line_trace_str ) + return s._convert_string( s._line_trace_str ).decode('ascii') else: {line_trace}