3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-05 14:04:07 +00:00

sby: core: Added preliminary support for [stage] sections

This commit is contained in:
Aki Van Ness 2022-03-31 10:06:02 -04:00
parent 4cccbf77fa
commit ed82c78acc
No known key found for this signature in database
GPG key ID: C629E8EC06327BEE

View file

@ -248,6 +248,7 @@ class SbyConfig:
self.options = dict()
self.engines = list()
self.setup = dict()
self.stage = dict()
self.script = list()
self.autotune_config = None
self.files = dict()
@ -301,6 +302,27 @@ class SbyConfig:
self.error(f"sby file syntax error: {line}")
continue
if entries[0] == "stage":
mode = "stage"
if len(entries) > 3 or len(entries) < 2:
self.error(f"sby file syntax error: {line}")
if len(entries) == 2:
parent = None
else:
parent = entries[2]
key = entries[1]
if key in self.stage:
self.error(f"stage {key} already defined")
self.stage[key] = {
'parent': parent
}
continue
if section == "script":
mode = "script"
if len(self.script) != 0:
@ -380,6 +402,35 @@ class SbyConfig:
self.setup[key] = kvp[1:]
continue
if mode == "stage":
self.error("[stage] section not yet supported")
kvp = line.split()
if key is None or key == '':
self.error(f"sby file syntax error: in stage mode but unknown key")
if len(kvp) == 0:
continue
if kvp[0] not in ("mode", "depth", "timeout", "expect", "engine",
"cutpoint", "enable", "disable", "assume", "skip",
"check", "prove", "abstract", "setsel") or len(kvp) < 2:
self.error(f"sby file syntax error: {line}")
else:
stmt = kvp[0]
if stmt == 'setsel':
if len(kvp[1:]) < 2:
self.error(f"sby file syntax error: {line}")
elif kvp[1][0] != '@':
self.error(f"sby file syntax error: {line}")
else:
name = kvp[1][1:]
self.stage[key][stmt] = {
'name': name, 'pattern': kvp[2:]
}
else:
self.stage[key][stmt] = kvp[1:]
continue
if mode == "script":
self.script.append(line)
continue
@ -834,6 +885,11 @@ class SbyTask(SbyConfig):
with open(f"{self.workdir}/config.sby", "r") as f:
self.parse_config(f)
if len(self.stage) == 0:
self.stage['default'] = {
'enable', '*'
}
self.handle_str_option("mode", None)
if self.opt_mode not in ["bmc", "prove", "cover", "live"]: