3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-10-03 16:23:57 +00:00

create json export and read in properties

This commit is contained in:
N. Engelhardt 2022-01-19 19:34:11 +01:00
parent 6ec2df34e3
commit 7f3c4137c1
3 changed files with 125 additions and 15 deletions

View file

@ -23,6 +23,7 @@ import subprocess
from shutil import copyfile, copytree, rmtree
from select import select
from time import time, localtime, sleep
from sby_design import SbyProperty, SbyModule, design_hierarchy
all_procs_running = []
@ -222,6 +223,7 @@ class SbyTask:
self.status = "UNKNOWN"
self.total_time = 0
self.expect = []
self.design_hierarchy = None
yosys_program_prefix = "" ##yosys-program-prefix##
self.exe_paths = {
@ -390,6 +392,8 @@ class SbyTask:
print("opt -keepdc -fast", file=f)
print("check", file=f)
print("hierarchy -simcheck", file=f)
# FIXME: can using design and design_nomem in the same task happen?
print(f"""write_json ../model/design{"" if model_name == "base" else "_nomem"}.json""", file=f)
print(f"""write_ilang ../model/design{"" if model_name == "base" else "_nomem"}.il""", file=f)
proc = SbyProc(
@ -401,6 +405,14 @@ class SbyTask:
)
proc.checkretcode = True
def instance_hierarchy_callback(retcode):
assert retcode == 0
assert self.design_hierarchy == None # verify this assumption
with open(f"""{self.workdir}/model/design{"" if model_name == "base" else "_nomem"}.json""") as f:
self.design_hierarchy = design_hierarchy(f)
proc.exit_callback = instance_hierarchy_callback
return [proc]
if re.match(r"^smt2(_syn)?(_nomem)?(_stbv|_stdt)?$", model_name):