Skip to content

Vtr flow max router iteration fix #1460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions vtr_flow/scripts/run_vtr_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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),
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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
Expand Down