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

sby: fixed issue where engine index would be out of range

This commit is contained in:
Aki Van Ness 2022-08-18 05:51:03 -04:00
parent 8f5508142d
commit 41b4ce5a7e
No known key found for this signature in database
GPG key ID: C629E8EC06327BEE
5 changed files with 8 additions and 12 deletions

View file

@ -246,8 +246,7 @@ class SbyAbort(BaseException):
class SbyConfig: class SbyConfig:
def __init__(self): def __init__(self):
self.options = dict() self.options = dict()
# Define a default case for the engine block self.engines = dict()
self.engines = { None: list() }
self.setup = dict() self.setup = dict()
self.stage = dict() self.stage = dict()
self.script = list() self.script = list()
@ -263,7 +262,7 @@ class SbyConfig:
for line in f: for line in f:
raw_line = line raw_line = line
if mode in ["options", "engines", "files", "autotune"]: if mode in ["options", "engines", "files", "autotune", "setup", "stage"]:
line = re.sub(r"\s*(\s#.*)?$", "", line) line = re.sub(r"\s*(\s#.*)?$", "", line)
if line == "" or line[0] == "#": if line == "" or line[0] == "#":
continue continue
@ -404,6 +403,8 @@ class SbyConfig:
if mode == "engines": if mode == "engines":
args = line.strip().split() args = line.strip().split()
if engine_mode not in self.engines:
self.engines[engine_mode] = list()
self.engines[engine_mode].append(args) self.engines[engine_mode].append(args)
continue continue

View file

@ -29,14 +29,13 @@ def run(task):
engine = engine_section engine = engine_section
engine_name = None engine_name = None
else: else:
assert len(engine_section[1]) > 0
engine = engine_section[1][0] engine = engine_section[1][0]
engine_name = engine_section[0] engine_name = engine_section[0]
if engine_name is None: if engine_name is None:
engine_name = engine_idx engine_name = engine_idx
assert len(engine) > 0
task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.log(f"""engine_{engine_name}: {" ".join(engine)}""")
task.makedirs(f"{task.workdir}/engine_{engine_idx}") task.makedirs(f"{task.workdir}/engine_{engine_idx}")

View file

@ -28,15 +28,13 @@ def run(task):
engine = engine_section engine = engine_section
engine_name = None engine_name = None
else: else:
assert len(engine_section[1]) > 0
engine = engine_section[1][0] engine = engine_section[1][0]
engine_name = engine_section[0] engine_name = engine_section[0]
if engine_name is None: if engine_name is None:
engine_name = engine_idx engine_name = engine_idx
assert len(engine) > 0
task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.log(f"""engine_{engine_name}: {" ".join(engine)}""")
task.makedirs(f"{task.workdir}/engine_{engine_idx}") task.makedirs(f"{task.workdir}/engine_{engine_idx}")

View file

@ -29,14 +29,13 @@ def run(task):
engine = engine_section engine = engine_section
engine_name = None engine_name = None
else: else:
assert len(engine_section[1]) > 0
engine = engine_section[1][0] engine = engine_section[1][0]
engine_name = engine_section[0] engine_name = engine_section[0]
if engine_name is None: if engine_name is None:
engine_name = engine_idx engine_name = engine_idx
assert len(engine) > 0
task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.log(f"""engine_{engine_name}: {" ".join(engine)}""")
task.makedirs(f"{task.workdir}/engine_{engine_idx}") task.makedirs(f"{task.workdir}/engine_{engine_idx}")

View file

@ -36,14 +36,13 @@ def run(task):
engine = engine_section engine = engine_section
engine_name = None engine_name = None
else: else:
assert len(engine_section[1]) > 0
engine = engine_section[1][0] engine = engine_section[1][0]
engine_name = engine_section[0] engine_name = engine_section[0]
if engine_name is None: if engine_name is None:
engine_name = engine_idx engine_name = engine_idx
assert len(engine) > 0
task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.log(f"""engine_{engine_name}: {" ".join(engine)}""")
task.makedirs(f"{task.workdir}/engine_{engine_idx}") task.makedirs(f"{task.workdir}/engine_{engine_idx}")