Skip to content
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

fixed sdc file copy and parmys abs path to temp folder issue #2427

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
22 changes: 13 additions & 9 deletions vtr_flow/scripts/run_vtr_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def vtr_command_argparser(prog=None):
help="Tells VPR the amount of iterations allowed to obtain the critical path.",
)
vpr.add_argument(
"-fix_pins",
"--fix_pins",
type=str,
help="Controls how the placer handles I/O pads during placement.",
)
Expand Down Expand Up @@ -424,7 +424,7 @@ def vtr_command_argparser(prog=None):
help="Tells VPR to run routing stage",
)
vpr.add_argument(
"-sdc_file", default=None, type=str, help="Path to SDC timing constraints file."
"--sdc_file", default=None, type=str, help="Path to SDC timing constraints file."
)
vpr.add_argument(
"-read_vpr_constraints", default=None, type=str, help="Path to vpr constraints file."
Expand Down Expand Up @@ -525,6 +525,8 @@ def vtr_command_main(arg_list, prog=None):

assert args.temp_dir
temp_dir = Path(args.temp_dir)
if not str(temp_dir).startswith("/"):
WhiteNinjaZ marked this conversation as resolved.
Show resolved Hide resolved
temp_dir = Path(os.getcwd() + "/" + args.temp_dir)
# Specify how command should be run
command_runner = vtr.CommandRunner(
track_memory=args.track_memory_usage,
Expand All @@ -538,14 +540,17 @@ def vtr_command_main(arg_list, prog=None):
exit_status = 0
return_status = 0
try:
# Create temp dir
os.makedirs(temp_dir, exist_ok=True)

vpr_args = process_unknown_args(unknown_args)
vpr_args = process_vpr_args(args, prog, temp_dir, vpr_args)
if args.sdc_file:
sdc_file_copy = get_sdc_file(args.sdc_file, prog, temp_dir)
sdc_file_copy = get_sdc_file(args.sdc_file, temp_dir)
vpr_args["sdc_file"] = Path(sdc_file_copy).name
if args.read_vpr_constraints:
vpr_constraint_file_copy = get_read_vpr_constraints(
args.read_vpr_constraints, prog, temp_dir
args.read_vpr_constraints, temp_dir
)
vpr_args["read_vpr_constraints"] = Path(vpr_constraint_file_copy).name

Expand Down Expand Up @@ -760,25 +765,24 @@ def process_vpr_args(args, prog, temp_dir, vpr_args):
return vpr_args


def get_sdc_file(sdc_file, prog, temp_dir):
def get_sdc_file(sdc_file, temp_dir):
"""
takes in the sdc_file and returns a path to that file if it exists.
"""
if not sdc_file.startswith("/"):
sdc_file = Path(prog).parent.parent / sdc_file
sdc_file = os.getcwd() + "/" + str(sdc_file)
sdc_file_name = Path(sdc_file).name
sdc_file_copy = Path(temp_dir) / Path(sdc_file_name)
shutil.copy(str(sdc_file), str(sdc_file_copy))

return str(vtr.verify_file(sdc_file_copy, "sdc file"))


def get_read_vpr_constraints(read_vpr_constraints, prog, temp_dir):
def get_read_vpr_constraints(read_vpr_constraints, temp_dir):
"""
takes in the read_vpr_constraints and returns a path to that file if it exists.
"""
if not read_vpr_constraints.startswith("/"):
read_vpr_constraints = Path(prog).parent.parent / read_vpr_constraints
read_vpr_constraints = os.getcwd() + "/" + str(read_vpr_constraints)
vpr_constraint_file_name = Path(read_vpr_constraints).name
vpr_constraint_file_copy = Path(temp_dir) / Path(vpr_constraint_file_name)
shutil.copy(str(read_vpr_constraints), str(vpr_constraint_file_copy))
Expand Down
Loading