From 9732f9e041802a7daba8ead71ced5a90f3b299c1 Mon Sep 17 00:00:00 2001 From: Stuart Olsen Date: Mon, 6 Apr 2020 22:22:45 -0700 Subject: [PATCH] back.pysim: Eliminate duplicate dict lookup in VCD update --- nmigen/back/pysim.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nmigen/back/pysim.py b/nmigen/back/pysim.py index f0fa2da..dfe2ab5 100644 --- a/nmigen/back/pysim.py +++ b/nmigen/back/pysim.py @@ -132,7 +132,8 @@ class _VCDWaveformWriter(_WaveformWriter): self.gtkw_names[signal] = (*var_scope, var_name_suffix) def update(self, timestamp, signal, value): - if signal not in self.vcd_vars: + vcd_vars = self.vcd_vars.get(signal) + if vcd_vars is None: return vcd_timestamp = self.timestamp_to_vcd(timestamp) @@ -140,7 +141,7 @@ class _VCDWaveformWriter(_WaveformWriter): var_value = self.decode_to_vcd(signal, value) else: var_value = value - for vcd_var in self.vcd_vars[signal]: + for vcd_var in vcd_vars: self.vcd_writer.change(vcd_var, vcd_timestamp, var_value) def close(self, timestamp): -- 2.30.2