From: Stuart Olsen Date: Tue, 7 Apr 2020 05:22:45 +0000 (-0700) Subject: back.pysim: Eliminate duplicate dict lookup in VCD update X-Git-Tag: working_23jun2020~16 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e744097ab6f7fb37c90e18b30c4aef28fd6be6b;p=nmigen.git back.pysim: Eliminate duplicate dict lookup in VCD update --- 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):