logic_analyzer: use context manager for VCD file export
This commit is contained in:
parent
fef4f83c3d
commit
82f289aa74
|
|
@ -129,9 +129,11 @@ class LogicAnalyzerCapture:
|
|||
|
||||
# Use the same datetime format that iVerilog uses
|
||||
timestamp = datetime.now().strftime("%a %b %w %H:%M:%S %Y")
|
||||
vcd_file = open(path, "w")
|
||||
|
||||
with VCDWriter(vcd_file, timescale, timestamp, "manta") as writer:
|
||||
with (
|
||||
open(path, "w") as vcd_file,
|
||||
VCDWriter(vcd_file, timescale, timestamp, "manta") as writer,
|
||||
):
|
||||
# Each probe has a name, width, and writer associated with it
|
||||
signals = []
|
||||
for p in self._probes:
|
||||
|
|
@ -168,8 +170,6 @@ class LogicAnalyzerCapture:
|
|||
|
||||
writer.change(var, sample_timestamp, sample)
|
||||
|
||||
vcd_file.close()
|
||||
|
||||
def get_playback_module(self):
|
||||
"""
|
||||
Returns an Amaranth module that will playback the captured data. This
|
||||
|
|
|
|||
Loading…
Reference in New Issue