mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-05 22:14:08 +00:00
add --init-config option
This commit is contained in:
parent
8a62780b9d
commit
f22b6921c5
|
@ -68,6 +68,8 @@ parser.add_argument("--dumpfiles", action="store_true", dest="dump_files",
|
||||||
help="print the list of source files")
|
help="print the list of source files")
|
||||||
parser.add_argument("--setup", action="store_true", dest="setupmode",
|
parser.add_argument("--setup", action="store_true", dest="setupmode",
|
||||||
help="set up the working directory and exit")
|
help="set up the working directory and exit")
|
||||||
|
parser.add_argument("--init-config", action="store_true", dest="initconfig",
|
||||||
|
help="create a default .sby config file")
|
||||||
|
|
||||||
parser.add_argument("sbyfile", metavar="<jobname>.sby | <dirname>", nargs="?",
|
parser.add_argument("sbyfile", metavar="<jobname>.sby | <dirname>", nargs="?",
|
||||||
help=".sby file OR directory containing config.sby file")
|
help=".sby file OR directory containing config.sby file")
|
||||||
|
@ -89,6 +91,23 @@ dump_tasks = args.dump_tasks
|
||||||
dump_files = args.dump_files
|
dump_files = args.dump_files
|
||||||
reusedir = False
|
reusedir = False
|
||||||
setupmode = args.setupmode
|
setupmode = args.setupmode
|
||||||
|
initconfig = args.initconfig
|
||||||
|
|
||||||
|
def init_config(filename):
|
||||||
|
with open(filename, 'w') as config:
|
||||||
|
config.write("""
|
||||||
|
[options]
|
||||||
|
mode bmc
|
||||||
|
|
||||||
|
[engines]
|
||||||
|
smtbmc
|
||||||
|
|
||||||
|
[script]
|
||||||
|
read -formal default.v
|
||||||
|
prep -top top
|
||||||
|
|
||||||
|
[files]
|
||||||
|
default.v""")
|
||||||
|
|
||||||
if sbyfile is not None:
|
if sbyfile is not None:
|
||||||
if os.path.isdir(sbyfile):
|
if os.path.isdir(sbyfile):
|
||||||
|
@ -115,6 +134,11 @@ if sbyfile is not None:
|
||||||
print("ERROR: Sby file does not have .sby file extension.", file=sys.stderr)
|
print("ERROR: Sby file does not have .sby file extension.", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
elif initconfig:
|
||||||
|
print("default sby config written to default.sby", file=sys.stderr)
|
||||||
|
init_config("default.sby")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
early_logmsgs = list()
|
early_logmsgs = list()
|
||||||
|
|
||||||
def early_log(workdir, msg):
|
def early_log(workdir, msg):
|
||||||
|
@ -122,7 +146,6 @@ def early_log(workdir, msg):
|
||||||
early_logmsgs.append("SBY %2d:%02d:%02d [%s] %s" % (tm.tm_hour, tm.tm_min, tm.tm_sec, workdir, msg))
|
early_logmsgs.append("SBY %2d:%02d:%02d [%s] %s" % (tm.tm_hour, tm.tm_min, tm.tm_sec, workdir, msg))
|
||||||
print(early_logmsgs[-1])
|
print(early_logmsgs[-1])
|
||||||
|
|
||||||
|
|
||||||
def read_sbyconfig(sbydata, taskname):
|
def read_sbyconfig(sbydata, taskname):
|
||||||
cfgdata = list()
|
cfgdata = list()
|
||||||
tasklist = list()
|
tasklist = list()
|
||||||
|
|
Loading…
Reference in a new issue