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-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9732f9e041802a7daba8ead71ced5a90f3b299c1;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):