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:
parent
9a14f4d238
commit
4cccbf77fa
|
@ -247,6 +247,7 @@ class SbyConfig:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.options = dict()
|
self.options = dict()
|
||||||
self.engines = list()
|
self.engines = list()
|
||||||
|
self.setup = dict()
|
||||||
self.script = list()
|
self.script = list()
|
||||||
self.autotune_config = None
|
self.autotune_config = None
|
||||||
self.files = dict()
|
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}")
|
self.error(f"sby file syntax error: '[engines]' section does not accept any arguments. got {args}")
|
||||||
continue
|
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":
|
if section == "script":
|
||||||
mode = "script"
|
mode = "script"
|
||||||
if len(self.script) != 0:
|
if len(self.script) != 0:
|
||||||
|
@ -351,6 +358,28 @@ class SbyConfig:
|
||||||
self.engines.append(entries)
|
self.engines.append(entries)
|
||||||
continue
|
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":
|
if mode == "script":
|
||||||
self.script.append(line)
|
self.script.append(line)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue