back.pysim: avoid malformed VCD files when a decoder uses tabs.
authorwhitequark <whitequark@whitequark.org>
Wed, 10 Jul 2019 12:54:59 +0000 (12:54 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 10 Jul 2019 12:54:59 +0000 (12:54 +0000)
nmigen/back/pysim.py

index c5dd4947a1b494d774cda23d6ce745d4de847152..a32a9677dc2c2c81d2e851f951367924a0037880 100644 (file)
@@ -543,7 +543,7 @@ class Simulator:
                 if signal.decoder:
                     var_type = "string"
                     var_size = 1
-                    var_init = signal.decoder(signal.reset).replace(" ", "_")
+                    var_init = signal.decoder(signal.reset).expandtabs().replace(" ", "_")
                 else:
                     var_type = "wire"
                     var_size = signal.nbits
@@ -649,7 +649,7 @@ class Simulator:
             for vcd_signal in self._vcd_signals[signal_slot]:
                 signal = self._slot_signals[signal_slot]
                 if signal.decoder:
-                    var_value = signal.decoder(new).replace(" ", "_")
+                    var_value = signal.decoder(new).expandtabs().replace(" ", "_")
                 else:
                     var_value = new
                 vcd_timestamp = (self._timestamp + self._delta) / self._epsilon