From 1554f583b7ddf307c1d118c4bb0fa1f44a997acf Mon Sep 17 00:00:00 2001 From: ganeshgore Date: Wed, 25 Nov 2020 17:22:41 -0700 Subject: [PATCH] [Flow] Now support explicit variable file for task --- openfpga_flow/scripts/run_fpga_flow.py | 13 +++++++++++++ openfpga_flow/scripts/run_fpga_task.py | 3 +++ 2 files changed, 16 insertions(+) diff --git a/openfpga_flow/scripts/run_fpga_flow.py b/openfpga_flow/scripts/run_fpga_flow.py index a331d506d..a84ee915f 100644 --- a/openfpga_flow/scripts/run_fpga_flow.py +++ b/openfpga_flow/scripts/run_fpga_flow.py @@ -14,9 +14,11 @@ import time from datetime import timedelta import shlex import glob +import json import argparse from configparser import ConfigParser, ExtendedInterpolation import logging +from envyaml import EnvYAML import glob import subprocess import threading @@ -85,6 +87,8 @@ parser.add_argument('--openfpga_shell_template', type=str, help="Sample openfpga shell script") parser.add_argument('--openfpga_arch_file', type=str, help="Openfpga architecture file for shell") +parser.add_argument('--arch_variable_file', type=str, default=None, + help="Openfpga architecture file for shell") # parser.add_argument('--openfpga_sim_setting_file', type=str, # help="Openfpga simulation file for shell") # parser.add_argument('--external_fabric_key_file', type=str, @@ -313,6 +317,15 @@ def read_script_config(): clean_up_and_exit("Missing CAD_TOOLS_PATH in openfpga_flow config") cad_tools = config["CAD_TOOLS_PATH"] + if args.arch_variable_file: + _, file_extension = os.path.splitext(args.arch_variable_file) + if file_extension in [".yml", ".yaml"]: + script_env_vars["PATH"].update( + EnvYAML(args.arch_variable_file, include_environment=False)) + if file_extension in [".json", ]: + with open(args.arch_variable_file, "r") as fp: + script_env_vars["PATH"].update(json.load(fp)) + def validate_command_line_arguments(): """ diff --git a/openfpga_flow/scripts/run_fpga_task.py b/openfpga_flow/scripts/run_fpga_task.py index 6ab46e1df..7fb0346dc 100644 --- a/openfpga_flow/scripts/run_fpga_task.py +++ b/openfpga_flow/scripts/run_fpga_task.py @@ -371,6 +371,9 @@ def create_run_command(curr_job_dir, archfile, benchmark_obj, param, task_conf): command += ["--power"] command += ["--power_tech", task_gc.get("power_tech_file")] + if task_gc.get("arch_variable_file"): + command += ["--arch_variable_file", task_gc.get("arch_variable_file")] + if task_gc.getboolean("spice_output"): command += ["--vpr_fpga_spice"]