diff --git a/openfpga/src/base/openfpga_setup_command_template.h b/openfpga/src/base/openfpga_setup_command_template.h index 96d8e3e3b..960130697 100644 --- a/openfpga/src/base/openfpga_setup_command_template.h +++ b/openfpga/src/base/openfpga_setup_command_template.h @@ -858,6 +858,48 @@ ShellCommandId add_write_module_naming_rules_command_template( return shell_cmd_id; } +/******************************************************************** + * - Add a command to Shell environment: write_pin_physical_location + * - Add associated options + * - Add command dependency + *******************************************************************/ +template +ShellCommandId add_write_pin_physical_location_command_template( + openfpga::Shell& shell, const ShellCommandClassId& cmd_class_id, + const std::vector& dependent_cmds, const bool& hidden) { + Command shell_cmd("write_pin_physical_location"); + /* Add an option '--file' in short '-f'*/ + CommandOptionId opt_file = shell_cmd.add_option( + "file", true, "file path to the XML file that contains pin physical location"); + shell_cmd.set_option_short_name(opt_file, "f"); + shell_cmd.set_option_require_value(opt_file, openfpga::OPT_STRING); + + /* Add an option '--module'*/ + CommandOptionId opt_module = shell_cmd.add_option( + "module", false, "specify the module whose pin physical location should be outputted"); + shell_cmd.set_option_require_value(opt_module, openfpga::OPT_STRING); + + /* Add an option '--no_time_stamp' */ + shell_cmd.add_option("no_time_stamp", false, + "Do not print time stamp in output files"); + + shell_cmd.add_option("verbose", false, "Show verbose outputs"); + + /* Add command to the Shell */ + ShellCommandId shell_cmd_id = shell.add_command( + shell_cmd, + "Output the pin physical location of an FPGA fabric to a given file", + hidden); + shell.set_command_class(shell_cmd_id, cmd_class_id); + shell.set_command_const_execute_function( + shell_cmd_id, write_pin_physical_location_template); + + /* Add command dependency to the Shell */ + shell.set_command_dependency(shell_cmd_id, dependent_cmds); + + return shell_cmd_id; +} + template void add_setup_command_templates(openfpga::Shell& shell, const bool& hidden = false) { @@ -1098,6 +1140,16 @@ void add_setup_command_templates(openfpga::Shell& shell, add_write_module_naming_rules_command_template( shell, openfpga_setup_cmd_class, cmd_dependency_write_module_naming_rules, hidden); + + /******************************** + * Command 'write_pin_physical_location' + */ + /* The command should NOT be executed before 'build_fabric' */ + std::vector cmd_dependency_write_pin_physical_location; + cmd_dependency_write_pin_physical_location.push_back(build_fabric_cmd_id); + add_write_pin_physical_location_command_template( + shell, openfpga_setup_cmd_class, cmd_dependency_write_pin_physical_location, + hidden); } } /* end namespace openfpga */