From f22b6921c5fe26d0d695b77cc129a98f6fb3b482 Mon Sep 17 00:00:00 2001 From: matt venn Date: Wed, 25 Mar 2020 18:00:48 +0100 Subject: [PATCH 1/2] add --init-config option --- sbysrc/sby.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sbysrc/sby.py b/sbysrc/sby.py index cdcaff4..72dcd79 100644 --- a/sbysrc/sby.py +++ b/sbysrc/sby.py @@ -68,6 +68,8 @@ parser.add_argument("--dumpfiles", action="store_true", dest="dump_files", help="print the list of source files") parser.add_argument("--setup", action="store_true", dest="setupmode", 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=".sby | ", nargs="?", help=".sby file OR directory containing config.sby file") @@ -89,6 +91,23 @@ dump_tasks = args.dump_tasks dump_files = args.dump_files reusedir = False 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 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) 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() 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)) print(early_logmsgs[-1]) - def read_sbyconfig(sbydata, taskname): cfgdata = list() tasklist = list() From 5eee219127ccf938e89c4c60a4bfed050c6c0a50 Mon Sep 17 00:00:00 2001 From: matt venn Date: Thu, 26 Mar 2020 18:24:56 +0100 Subject: [PATCH 2/2] use argument for name of .sby and .sv files --- sbysrc/sby.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sbysrc/sby.py b/sbysrc/sby.py index 72dcd79..f17e842 100644 --- a/sbysrc/sby.py +++ b/sbysrc/sby.py @@ -68,9 +68,9 @@ parser.add_argument("--dumpfiles", action="store_true", dest="dump_files", help="print the list of source files") parser.add_argument("--setup", action="store_true", dest="setupmode", 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("--init-config-file", dest="init_config_file", + help="create a default .sby config file") parser.add_argument("sbyfile", metavar=".sby | ", nargs="?", help=".sby file OR directory containing config.sby file") parser.add_argument("arg_tasknames", metavar="tasknames", nargs="*", @@ -91,23 +91,7 @@ dump_tasks = args.dump_tasks dump_files = args.dump_files reusedir = False 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""") +init_config_file = args.init_config_file if sbyfile is not None: if os.path.isdir(sbyfile): @@ -134,9 +118,25 @@ if sbyfile is not None: print("ERROR: Sby file does not have .sby file extension.", file=sys.stderr) sys.exit(1) -elif initconfig: - print("default sby config written to default.sby", file=sys.stderr) - init_config("default.sby") +elif init_config_file is not None: + sv_file = init_config_file + ".sv" + sby_file = init_config_file + ".sby" + with open(sby_file, 'w') as config: + config.write("""[options] +mode bmc + +[engines] +smtbmc + +[script] +read -formal {0} +prep -top top + +[files] +{0} +""".format(sv_file)) + + print("sby config written to {}".format(sby_file), file=sys.stderr) sys.exit(0) early_logmsgs = list()