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:
parent
4cccbf77fa
commit
ed82c78acc
|
@ -248,6 +248,7 @@ class SbyConfig:
|
||||||
self.options = dict()
|
self.options = dict()
|
||||||
self.engines = list()
|
self.engines = list()
|
||||||
self.setup = dict()
|
self.setup = dict()
|
||||||
|
self.stage = dict()
|
||||||
self.script = list()
|
self.script = list()
|
||||||
self.autotune_config = None
|
self.autotune_config = None
|
||||||
self.files = dict()
|
self.files = dict()
|
||||||
|
@ -301,6 +302,27 @@ class SbyConfig:
|
||||||
self.error(f"sby file syntax error: {line}")
|
self.error(f"sby file syntax error: {line}")
|
||||||
continue
|
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":
|
if section == "script":
|
||||||
mode = "script"
|
mode = "script"
|
||||||
if len(self.script) != 0:
|
if len(self.script) != 0:
|
||||||
|
@ -380,6 +402,35 @@ class SbyConfig:
|
||||||
self.setup[key] = kvp[1:]
|
self.setup[key] = kvp[1:]
|
||||||
continue
|
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":
|
if mode == "script":
|
||||||
self.script.append(line)
|
self.script.append(line)
|
||||||
continue
|
continue
|
||||||
|
@ -834,6 +885,11 @@ class SbyTask(SbyConfig):
|
||||||
with open(f"{self.workdir}/config.sby", "r") as f:
|
with open(f"{self.workdir}/config.sby", "r") as f:
|
||||||
self.parse_config(f)
|
self.parse_config(f)
|
||||||
|
|
||||||
|
if len(self.stage) == 0:
|
||||||
|
self.stage['default'] = {
|
||||||
|
'enable', '*'
|
||||||
|
}
|
||||||
|
|
||||||
self.handle_str_option("mode", None)
|
self.handle_str_option("mode", None)
|
||||||
|
|
||||||
if self.opt_mode not in ["bmc", "prove", "cover", "live"]:
|
if self.opt_mode not in ["bmc", "prove", "cover", "live"]:
|
||||||
|
|
Loading…
Reference in a new issue