3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-02 09:20:23 +00:00

Moved smt2 yosys info parsing from smtbmc.py to smtio.py

This commit is contained in:
Clifford Wolf 2016-07-11 11:49:05 +02:00
parent cdb58f68ab
commit 0153ad85d9
3 changed files with 56 additions and 16 deletions

View file

@ -95,37 +95,28 @@ smt = smtio(opts=so)
print("%s Solver: %s" % (smt.timestamp(), so.solver))
smt.setup("QF_AUFBV")
debug_nets = dict()
debug_nets_re = re.compile(r"^; yosys-smt2-(input|output|register|wire) (\S+) (\d+)")
current_module = None
with open(args[0], "r") as f:
for line in f:
match = debug_nets_re.match(line)
if match:
debug_nets[current_module].add(match.group(2))
if line.startswith("; yosys-smt2-module"):
current_module = line.split()[2]
debug_nets[current_module] = set()
smt.write(line)
if topmod is None:
topmod = current_module
smt.getinfo(line)
if topmod is None:
topmod = smt.topmod
assert topmod is not None
assert topmod in debug_nets
assert topmod in smt.modinfo
def write_vcd_model(steps):
print("%s Writing model to VCD file." % smt.timestamp())
vcd = mkvcd(open(vcdfile, "w"))
for netname in sorted(debug_nets[topmod]):
for netname in sorted(smt.modinfo[topmod].wsize.keys()):
width = len(smt.get_net_bin(topmod, netname, "s0"))
vcd.add_net(netname, width)
for i in range(steps):
vcd.set_time(i)
for netname in debug_nets[topmod]:
for netname in smt.modinfo[topmod].wsize.keys():
vcd.set_net(netname, smt.get_net_bin(topmod, netname, "s%d" % i))
vcd.set_time(steps)