diff --git a/vtr_flow/scripts/run_vtr_flow.py b/vtr_flow/scripts/run_vtr_flow.py index 6ed8300f08c..a1d9eb6833f 100755 --- a/vtr_flow/scripts/run_vtr_flow.py +++ b/vtr_flow/scripts/run_vtr_flow.py @@ -10,14 +10,16 @@ import socket from datetime import datetime from collections import OrderedDict -#pylint: disable=wrong-import-position, import-error + +# pylint: disable=wrong-import-position, import-error sys.path.insert(0, str(Path(__file__).resolve().parent / "python_libs")) import vtr -#pylint: enable=wrong-import-position, import-error + +# pylint: enable=wrong-import-position, import-error BASIC_VERBOSITY = 1 -#pylint: disable=too-few-public-methods +# pylint: disable=too-few-public-methods class VtrStageArgparseAction(argparse.Action): """ Class to parse the VTR stages to begin and end at. @@ -34,7 +36,10 @@ def __call__(self, parser, namespace, value, option_string=None): setattr(namespace, self.dest, vtr.VtrStage.lec) else: raise argparse.ArgumentError(self, "Invalid VTR stage '" + value + "'") -#pylint: enable=too-few-public-methods + + +# pylint: enable=too-few-public-methods + def vtr_command_argparser(prog=None): """ @@ -411,13 +416,16 @@ def vtr_command_main(arg_list, prog=None): return_status = 0 try: vpr_args = process_unknown_args(unknown_args) - vpr_args.update(process_vpr_args(args, prog, temp_dir)) + vpr_args = process_vpr_args(args, prog, temp_dir, vpr_args) if args.sdc_file: vpr_args["sdc_file"] = get_sdc_file(args.sdc_file, prog) - print(args.name if args.name else Path(args.architecture_file).stem - + "/" - + Path(args.circuit_file).stem, end="\t\t") + print( + args.name + if args.name + else Path(args.architecture_file).stem + "/" + Path(args.circuit_file).stem, + end="\t\t", + ) # Run the flow vtr.run( Path(args.architecture_file), @@ -442,9 +450,7 @@ def vtr_command_main(arg_list, prog=None): error_status = "OK" except vtr.VtrError as error: error_status, return_status, exit_status = except_vtr_error( - error, - args.expect_fail, - args.verbose + error, args.expect_fail, args.verbose ) except KeyboardInterrupt as error: @@ -569,13 +575,13 @@ def process_odin_args(args): return odin_args -def process_vpr_args(args, prog, temp_dir): +def process_vpr_args(args, prog, temp_dir, vpr_args): """ Finds arguments needed in the VPR stage of the flow """ - vpr_args = OrderedDict() if args.crit_path_router_iterations: - vpr_args["max_router_iterations"] = args.crit_path_router_iterations + if "max_router_iterations" not in vpr_args: + vpr_args["max_router_iterations"] = args.crit_path_router_iterations if args.fix_pins: new_file = str(temp_dir / Path(args.fix_pins).name) shutil.copyfile(str((Path(prog).parent.parent / args.fix_pins)), new_file) @@ -590,6 +596,7 @@ def process_vpr_args(args, prog, temp_dir): return vpr_args + def get_sdc_file(sdc_file, prog): """ takes in the sdc_file and returns a path to that file if it exists. @@ -602,6 +609,7 @@ def get_sdc_file(sdc_file, prog): return str(vtr.verify_file(sdc_file, "sdc file")) + def except_vtr_error(error, expect_fail, verbose): """ Handle vtr exceptions