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 the [setup] section

This commit is contained in:
Aki Van Ness 2022-03-31 08:50:49 -04:00
parent 9a14f4d238
commit 4cccbf77fa
No known key found for this signature in database
GPG key ID: C629E8EC06327BEE

View file

@ -247,6 +247,7 @@ class SbyConfig:
def __init__(self):
self.options = dict()
self.engines = list()
self.setup = dict()
self.script = list()
self.autotune_config = None
self.files = dict()
@ -294,6 +295,12 @@ class SbyConfig:
self.error(f"sby file syntax error: '[engines]' section does not accept any arguments. got {args}")
continue
if entries[0] == "setup":
mode = "setup"
if len(self.setup) != 0 or len(entries) != 1:
self.error(f"sby file syntax error: {line}")
continue
if section == "script":
mode = "script"
if len(self.script) != 0:
@ -351,6 +358,28 @@ class SbyConfig:
self.engines.append(entries)
continue
if mode == "setup":
self.error("[setup] section not yet supported")
kvp = line.split()
if kvp[0] not in ("cutpoint", "disable", "enable", "assume", "define"):
self.error(f"sby file syntax error: {line}")
else:
stmt = kvp[0]
if stmt == 'define':
if 'define' not in self.setup:
self.setup['define'] = {}
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.setup['define'][name] = kvp[2:]
else:
self.setup[key] = kvp[1:]
continue
if mode == "script":
self.script.append(line)
continue