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

sby: core: config: updated the error messages for the new setctions to make them more descriptive

This commit is contained in:
Aki Van Ness 2022-07-29 10:34:36 -04:00
parent 9293081308
commit 204869bfed
No known key found for this signature in database
GPG key ID: C629E8EC06327BEE

View file

@ -393,7 +393,7 @@ class SbyConfig:
if mode == "setup": if mode == "setup":
kvp = line.split() kvp = line.split()
if kvp[0] not in ("cutpoint", "disable", "enable", "assume", "define"): if kvp[0] not in ("cutpoint", "disable", "enable", "assume", "define"):
self.error(f"sby file syntax error: {line}") self.error(f"sby file syntax error: found '{kvp[0]}' but expected one of 'cutpoint', 'disable', 'enable', 'assume', or 'define'")
else: else:
stmt = kvp[0] stmt = kvp[0]
if stmt == 'define': if stmt == 'define':
@ -401,9 +401,9 @@ class SbyConfig:
self.setup['define'] = {} self.setup['define'] = {}
if len(kvp[1:]) < 2: if len(kvp[1:]) < 2:
self.error(f"sby file syntax error: {line}") self.error(f"sby file syntax error: 'define' statement takes 2 arguments, got {len(kvp[1:])}")
elif kvp[1][0] != '@': elif kvp[1][0] != '@':
self.error(f"sby file syntax error: {line}") self.error(f"sby file syntax error: 'define' statement expects an '@' prefixed name as the first parameter, got {line}")
else: else:
name = kvp[1][1:] name = kvp[1][1:]
self.setup['define'][name] = kvp[2:] self.setup['define'][name] = kvp[2:]
@ -427,9 +427,9 @@ class SbyConfig:
stmt = kvp[0] stmt = kvp[0]
if stmt == 'setsel': if stmt == 'setsel':
if len(kvp[1:]) < 2: if len(kvp[1:]) < 2:
self.error(f"sby file syntax error: {line}") self.error(f"sby file syntax error: 'setsel' statement takes 2 arguments, got {len(kvp[1:])}")
elif kvp[1][0] != '@': elif kvp[1][0] != '@':
self.error(f"sby file syntax error: {line}") self.error(f"sby file syntax error: 'setsel' statement expects an '@' prefixed name as the first parameter, got {line}")
else: else:
name = kvp[1][1:] name = kvp[1][1:]
self.stage[key][stmt] = { self.stage[key][stmt] = {