[core] added a new command write_pin_physical_location

This commit is contained in:
tangxifan 2024-04-10 13:07:49 -07:00
parent c5db01f943
commit f1334645db
1 changed files with 52 additions and 0 deletions

View File

@ -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 <class T>
ShellCommandId add_write_pin_physical_location_command_template(
openfpga::Shell<T>& shell, const ShellCommandClassId& cmd_class_id,
const std::vector<ShellCommandId>& 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<T>);
/* Add command dependency to the Shell */
shell.set_command_dependency(shell_cmd_id, dependent_cmds);
return shell_cmd_id;
}
template <class T>
void add_setup_command_templates(openfpga::Shell<T>& shell,
const bool& hidden = false) {
@ -1098,6 +1140,16 @@ void add_setup_command_templates(openfpga::Shell<T>& shell,
add_write_module_naming_rules_command_template<T>(
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<ShellCommandId> 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<T>(
shell, openfpga_setup_cmd_class, cmd_dependency_write_pin_physical_location,
hidden);
}
} /* end namespace openfpga */