From bd23a3b423b52c28ae496b500243e5f52cb7ff16 Mon Sep 17 00:00:00 2001 From: Jevin Sweval Date: Mon, 20 Jun 2022 17:25:02 -0700 Subject: [PATCH] Don't dump VCD values if unchanged --- litescope/software/dump/vcd.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/litescope/software/dump/vcd.py b/litescope/software/dump/vcd.py index f5a8834..05d191d 100644 --- a/litescope/software/dump/vcd.py +++ b/litescope/software/dump/vcd.py @@ -57,19 +57,14 @@ class VCDDump(Dump): c = "" for v in self.variables: try: - if v.values[self.cnt + 1] != v.current_value: - c += "b" - c += dec2bin(v.values[self.cnt + 1], v.width) - c += " " - c += v.code - c += "\n" + val = v.values[self.cnt + 1] + if val != v.current_value: + v.current_value = val + c += f"b{dec2bin(val, v.width)} {v.code}\n" except: pass if c != "": - r += "#" - r += str(self.cnt+1) - r += "\n" - r += c + r += f"#{self.cnt + 1}\n{c}" return r def generate_date(self):