diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-08-27 13:44:53 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-08-27 13:44:53 +0200 |
commit | ebb0ea6f7b6b6ffa2c1284a9ad8fbb139e235282 (patch) | |
tree | 4cb52bd14fa197a0dbc42f926dcdfb06f76387c9 /scripts/smt2-bmc/smtio.py | |
parent | 4b62d4cbb93500a634deabdb4bd0fab1b90b10c0 (diff) | |
download | picorv32-ebb0ea6f7b6b6ffa2c1284a9ad8fbb139e235282.tar.gz picorv32-ebb0ea6f7b6b6ffa2c1284a9ad8fbb139e235282.zip |
Added mkvcd class to smtio.py
Diffstat (limited to 'scripts/smt2-bmc/smtio.py')
-rw-r--r-- | scripts/smt2-bmc/smtio.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/smt2-bmc/smtio.py b/scripts/smt2-bmc/smtio.py index dcdc3d2..b371a63 100644 --- a/scripts/smt2-bmc/smtio.py +++ b/scripts/smt2-bmc/smtio.py @@ -150,3 +150,32 @@ class smtio: def wait(self): self.p.wait() + +class mkvcd: + def __init__(self, f): + self.f = f + self.t = -1 + self.nets = dict() + + def add_net(self, name, width): + assert self.t == -1 + key = "n%d" % len(self.nets) + self.nets[name] = (key, width) + + def set_net(self, name, bits): + assert name in self.nets + assert self.t >= 0 + print("b%s %s" % (bits, self.nets[name][0]), file=self.f) + + def set_time(self, t): + assert t >= self.t + if t != self.t: + if self.t == -1: + for name in sorted(self.nets): + key, width = self.nets[name] + print("$var wire %d %s %s $end" % (width, key, name), file=self.f) + print("$enddefinitions $end", file=self.f) + self.t = t + assert self.t >= 0 + print("#%d" % self.t, file=self.f) + |