2023-01-06 22:52:37 -06:00
# ifndef OPENFPGA_SETUP_COMMAND_TEMPLATE_H
# define OPENFPGA_SETUP_COMMAND_TEMPLATE_H
/********************************************************************
* Add commands to the OpenFPGA shell interface ,
* in purpose of setting up OpenFPGA core engine , including :
* - read_openfpga_arch : read OpenFPGA architecture file
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# include "check_netlist_naming_conflict_template.h"
# include "openfpga_build_fabric_template.h"
# include "openfpga_link_arch_template.h"
# include "openfpga_lut_truth_table_fixup_template.h"
# include "openfpga_pb_pin_fixup_template.h"
# include "openfpga_pcf2place_template.h"
# include "openfpga_read_arch_template.h"
# include "openfpga_write_gsb_template.h"
# include "shell.h"
/* begin namespace openfpga */
namespace openfpga {
/********************************************************************
* - Add a command to Shell environment : read_openfpga_arch
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_read_openfpga_arch_command_template (
2023-01-07 13:40:17 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " read_openfpga_arch " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_arch_file =
shell_cmd . add_option ( " file " , true , " file path to the architecture XML " ) ;
shell_cmd . set_option_short_name ( opt_arch_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_arch_file , openfpga : : OPT_STRING ) ;
/* Add command 'read_openfpga_arch' to the Shell */
ShellCommandId shell_cmd_id =
2023-01-07 13:18:43 -06:00
shell . add_command ( shell_cmd , " read OpenFPGA architecture file " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
read_openfpga_arch_template < T > ) ;
2023-01-06 22:52:37 -06:00
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_openfpga_arch
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_write_openfpga_arch_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " write_openfpga_arch " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file =
shell_cmd . add_option ( " file " , true , " file path to the architecture XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'write_openfpga_arch' to the Shell */
ShellCommandId shell_cmd_id =
2023-01-07 13:18:43 -06:00
shell . add_command ( shell_cmd , " write OpenFPGA architecture file " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_const_execute_function ( shell_cmd_id ,
write_openfpga_arch_template < T > ) ;
2023-01-06 22:52:37 -06:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : read_openfpga_simulation_setting
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_read_simulation_setting_command_template (
2023-01-07 13:40:17 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " read_openfpga_simulation_setting " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the simulation setting XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'read_openfpga_arch' to the Shell */
2023-01-07 13:40:17 -06:00
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " read OpenFPGA simulation setting file " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
read_simulation_setting_template < T > ) ;
2023-01-06 22:52:37 -06:00
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_openfpga_simulation_setting
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_write_simulation_setting_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " write_openfpga_simulation_setting " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the simulation setting XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'write_openfpga_arch' to the Shell */
2023-01-07 13:40:17 -06:00
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " write OpenFPGA simulation setting file " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_const_execute_function (
shell_cmd_id , write_simulation_setting_template < T > ) ;
2023-01-06 22:52:37 -06:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : read_openfpga_bitstream_setting
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_read_bitstream_setting_command_template (
2023-01-07 13:40:17 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " read_openfpga_bitstream_setting " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the bitstream setting XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'read_openfpga_bitstream_setting' to the Shell */
2023-01-07 13:40:17 -06:00
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " read OpenFPGA bitstream setting file " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
read_bitstream_setting_template < T > ) ;
2023-01-06 22:52:37 -06:00
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_openfpga_bitstream_setting
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_write_bitstream_setting_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " write_openfpga_bitstream_setting " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the bitstream setting XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'write_openfpga_bitstream_setting' to the Shell */
2023-01-07 13:40:17 -06:00
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " write OpenFPGA bitstream setting file " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_const_execute_function ( shell_cmd_id ,
write_bitstream_setting_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : link_openfpga_arch
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_link_arch_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " link_openfpga_arch " ) ;
/* Add an option '--activity_file'*/
CommandOptionId opt_act_file = shell_cmd . add_option (
" activity_file " , false , " file path to the signal activity " ) ;
shell_cmd . set_option_require_value ( opt_act_file , openfpga : : OPT_STRING ) ;
/* Add an option '--sort_gsb_chan_node_in_edges'*/
shell_cmd . add_option ( " sort_gsb_chan_node_in_edges " , false ,
" Sort all the incoming edges for each routing track "
" output node in General Switch Blocks (GSBs) " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'link_openfpga_arch' to the Shell */
ShellCommandId shell_cmd_id =
2023-01-07 13:18:43 -06:00
shell . add_command ( shell_cmd , " Bind OpenFPGA architecture to VPR " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id , link_arch_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_gsb_to_xml
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_write_gsb_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " write_gsb_to_xml " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " path to the directory that stores the XML files " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add an option '--unique' */
shell_cmd . add_option ( " unique " , false , " Only output unique GSB blocks " ) ;
/* Add an option '--exclude_rr_info' */
shell_cmd . add_option ( " exclude_rr_info " , false ,
" Exclude routing resource graph information from output "
" files, e.g., node id as well as other attributes. This "
" is useful to check the connection inside GSBs purely. " ) ;
/* Add an option '--exclude'*/
CommandOptionId opt_exclude =
shell_cmd . add_option ( " exclude " , false ,
" Exclude part of the GSB data to be outputted. Can be "
" [``sb``|``cbx``|``cby``]. Users can exclude multiple "
" parts by using a splitter ``,`` " ) ;
shell_cmd . set_option_require_value ( opt_exclude , openfpga : : OPT_STRING ) ;
/* Add an option '--gsb_names'*/
CommandOptionId opt_gsb_names =
shell_cmd . add_option ( " gsb_names " , false ,
" Specify the name of GSB to be outputted. Users can "
" specify multiple GSBs by using a splitter ``,`` " ) ;
shell_cmd . set_option_require_value ( opt_gsb_names , openfpga : : OPT_STRING ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'write_openfpga_arch' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
2023-01-07 13:40:17 -06:00
shell_cmd , " write internal structures of General Switch Blocks to XML file " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_const_execute_function ( shell_cmd_id , write_gsb_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : check_netlist_naming_conflict
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_check_netlist_naming_conflict_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " check_netlist_naming_conflict " ) ;
/* Add an option '--fix' */
shell_cmd . add_option ( " fix " , false , " Apply correction to any conflicts found " ) ;
/* Add an option '--report' */
CommandOptionId opt_rpt = shell_cmd . add_option (
" report " , false , " Output a report file about what any correction applied " ) ;
shell_cmd . set_option_require_value ( opt_rpt , openfpga : : OPT_STRING ) ;
/* Add command 'check_netlist_naming_conflict' to the Shell */
ShellCommandId shell_cmd_id =
shell . add_command ( shell_cmd ,
" Check any block/net naming in users' BLIF netlist "
2023-01-07 13:40:17 -06:00
" violates the syntax of fabric generator " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id ,
check_netlist_naming_conflict_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : pb_pin_fixup
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_pb_pin_fixup_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " pb_pin_fixup " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'pb_pin_fixup' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd ,
2023-01-07 13:40:17 -06:00
" Fix up the packing results due to pin swapping during routing stage " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id , pb_pin_fixup_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : lut_truth_table_fixup
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_lut_truth_table_fixup_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " lut_truth_table_fixup " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'lut_truth_table_fixup' to the Shell */
ShellCommandId shell_cmd_id =
shell . add_command ( shell_cmd ,
" Fix up the truth table of Look-Up Tables due to pin "
2023-01-07 13:40:17 -06:00
" swapping during packing stage " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
lut_truth_table_fixup_template < T > ) ;
2023-01-06 22:52:37 -06:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : build_fabric
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_build_fabric_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " build_fabric " ) ;
/* Add an option '--frame_view' */
shell_cmd . add_option (
" frame_view " , false ,
" Build only frame view of the fabric (nets are skipped) " ) ;
/* Add an option '--compress_routing' */
shell_cmd . add_option ( " compress_routing " , false ,
" Compress the number of unique routing modules by "
" identifying the unique GSBs " ) ;
/* Add an option '--duplicate_grid_pin' */
shell_cmd . add_option ( " duplicate_grid_pin " , false ,
" Duplicate the pins on the same side of a grid " ) ;
2023-09-15 21:15:18 -05:00
/* Add an option '--name_module_using_index' */
shell_cmd . add_option ( " name_module_using_index " , false ,
2023-09-16 01:32:40 -05:00
" Use index to name modules, such as cbx_0_, rather than "
" coordinates, such as cbx_1__0_ " ) ;
2023-09-15 21:15:18 -05:00
2023-01-06 22:52:37 -06:00
/* Add an option '--load_fabric_key' */
CommandOptionId opt_load_fkey = shell_cmd . add_option (
" load_fabric_key " , false , " load the fabric key from the given file " ) ;
shell_cmd . set_option_require_value ( opt_load_fkey , openfpga : : OPT_STRING ) ;
/* Add an option '--write_fabric_key' */
CommandOptionId opt_write_fkey = shell_cmd . add_option (
" write_fabric_key " , false , " output current fabric key to a file " ) ;
shell_cmd . set_option_require_value ( opt_write_fkey , openfpga : : OPT_STRING ) ;
2023-07-14 13:01:04 -05:00
/* Add an option '--group_tile' */
CommandOptionId opt_group_tile = shell_cmd . add_option (
2023-07-14 14:16:40 -05:00
" group_tile " , false ,
" group programmable blocks and routing blocks into tiles. This helps to "
" reduce the number of blocks at top-level " ) ;
2023-07-14 13:01:04 -05:00
shell_cmd . set_option_require_value ( opt_group_tile , openfpga : : OPT_STRING ) ;
2023-07-31 19:32:48 -05:00
/* Add an option '--group_config_block' */
2023-08-02 21:46:27 -05:00
shell_cmd . add_option ( " group_config_block " , false ,
" group configuration memory blocks under CLB/SB/CB "
" blocks etc. This helps to "
" reduce optimize the density of configuration memory "
" through physical design " ) ;
2023-07-31 19:32:48 -05:00
2023-01-06 22:52:37 -06:00
/* Add an option '--generate_random_fabric_key' */
shell_cmd . add_option ( " generate_random_fabric_key " , false ,
" Create a random fabric key which will shuffle the "
" memory address for encryption purpose " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'compact_routing_hierarchy' to the Shell */
2023-01-07 13:40:17 -06:00
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " Build the FPGA fabric in a graph of modules " , hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id , build_fabric_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_fabric_hierarchy
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_write_fabric_hierarchy_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " write_fabric_hierarchy " ) ;
/* Add an option '--file' */
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " Specify the file name to write the hierarchy to " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
2024-05-02 20:05:38 -05:00
/* Add an option '--module' */
CommandOptionId opt_module = shell_cmd . add_option (
" module " , false , " Specify the root module name(s) which should be considered. By default, it is fpga_top. Regular expression is supported " ) ;
shell_cmd . set_option_require_value ( opt_module , openfpga : : OPT_STRING ) ;
CommandOptionId opt_filter = shell_cmd . add_option (
" filter " , false , " Specify the filter which allows user to select modules to appear under each root module tree. By default, it is *. Regular expression is supported " ) ;
shell_cmd . set_option_require_value ( opt_filter , openfpga : : OPT_STRING ) ;
2023-01-06 22:52:37 -06:00
/* Add an option '--depth' */
CommandOptionId opt_depth = shell_cmd . add_option (
" depth " , false ,
" Specify the depth of hierarchy to which the writer should stop " ) ;
shell_cmd . set_option_require_value ( opt_depth , openfpga : : OPT_INT ) ;
2024-05-02 20:05:38 -05:00
shell_cmd . add_option ( " exclude_empty_modules " , false , " Exclude modules with no qualified children (match the names defined through filter) from the output file " ) ;
2023-01-06 22:52:37 -06:00
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'write_fabric_hierarchy' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
2023-01-07 13:40:17 -06:00
shell_cmd , " Write the hierarchy of FPGA fabric graph to a plain-text file " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_const_execute_function ( shell_cmd_id ,
write_fabric_hierarchy_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_fabric_io_info
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_write_fabric_io_info_command_template (
2023-01-06 23:11:12 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
2023-01-07 13:18:43 -06:00
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " write_fabric_io_info " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to output the I/O information " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , 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 " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Enable verbose output " ) ;
/* Add command the Shell */
ShellCommandId shell_cmd_id =
shell . add_command ( shell_cmd ,
" Write the I/O information, e.g., locations and similar "
2023-01-07 13:40:17 -06:00
" attributes, to a file " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
write_fabric_io_info_template < T > ) ;
2023-01-06 22:52:37 -06:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : pcf2place
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-06 22:52:37 -06:00
ShellCommandId add_pcf2place_command_template (
2023-01-07 13:40:17 -06:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const bool & hidden ) {
2023-01-06 22:52:37 -06:00
Command shell_cmd ( " pcf2place " ) ;
/* Add an option '--pcf'*/
CommandOptionId opt_pcf_file =
shell_cmd . add_option ( " pcf " , true , " file path to the user pin constraint " ) ;
shell_cmd . set_option_require_value ( opt_pcf_file , openfpga : : OPT_STRING ) ;
/* Add an option '--blif'*/
CommandOptionId opt_blif_file = shell_cmd . add_option (
" blif " , true , " file path to the synthesized netlist (.blif) " ) ;
shell_cmd . set_option_require_value ( opt_blif_file , openfpga : : OPT_STRING ) ;
/* Add an option '--fpga_io_map'*/
CommandOptionId opt_fpga_io_map_file = shell_cmd . add_option (
" fpga_io_map " , true , " file path to FPGA I/O location map (.xml) " ) ;
shell_cmd . set_option_require_value ( opt_fpga_io_map_file ,
openfpga : : OPT_STRING ) ;
/* Add an option '--pin_table'*/
CommandOptionId opt_pin_table_file = shell_cmd . add_option (
" pin_table " , true , " file path to the pin table (.csv) " ) ;
shell_cmd . set_option_require_value ( opt_pin_table_file , openfpga : : OPT_STRING ) ;
/* Add an option '--fpga_fix_pins'*/
CommandOptionId opt_fpga_fix_pins_file = shell_cmd . add_option (
" fpga_fix_pins " , true ,
" file path to the output fix-pin placement file (.place) " ) ;
shell_cmd . set_option_require_value ( opt_fpga_fix_pins_file ,
openfpga : : OPT_STRING ) ;
/* Add an option '--pin_table_direction_convention'*/
CommandOptionId opt_pin_table_dir_convention =
shell_cmd . add_option ( " pin_table_direction_convention " , false ,
" the convention to follow when inferring pin "
" direction from the name of ports in pin table file " ) ;
shell_cmd . set_option_require_value ( opt_pin_table_dir_convention ,
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 " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Enable verbose output " ) ;
/* Add command to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
2023-01-07 13:40:17 -06:00
shell_cmd , " Convert user Pin Constraint File (.pcf) to an placement file " ,
hidden ) ;
2023-01-06 22:52:37 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-01-06 23:11:12 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
pcf2place_wrapper_template < T > ) ;
2023-01-06 22:52:37 -06:00
return shell_cmd_id ;
}
2023-02-22 23:58:25 -06:00
/********************************************************************
* - Add a command to Shell environment : read_openfpga_clock_arch
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_read_openfpga_clock_arch_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " read_openfpga_clock_arch " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the clock architecture XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'read_openfpga_clock_arch' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " read OpenFPGA clock architecture file " , hidden ) ;
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id ,
read_openfpga_clock_arch_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
/********************************************************************
* - Add a command to Shell environment : write_openfpga_clock_arch
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_write_openfpga_clock_arch_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " write_openfpga_clock_arch " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the clock architecture XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add command 'write_openfpga_clock_arch' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " write OpenFPGA clock architecture file " , hidden ) ;
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-02-23 00:01:24 -06:00
shell . set_command_const_execute_function (
shell_cmd_id , write_openfpga_clock_arch_template < T > ) ;
2023-02-22 23:58:25 -06:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-02-23 15:30:18 -06:00
/********************************************************************
* - Add a command to Shell environment : append_clock_rr_graph
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_append_clock_rr_graph_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " append_clock_rr_graph " ) ;
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'pb_pin_fixup' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd ,
2023-02-24 21:15:39 -06:00
" Append clock network to the routing resource graph built by VPR. " , hidden ) ;
2023-02-23 15:30:18 -06:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-02-24 21:15:39 -06:00
shell . set_command_execute_function ( shell_cmd_id ,
append_clock_rr_graph_template < T > ) ;
2023-02-23 15:30:18 -06:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-02-28 13:52:38 -06:00
/********************************************************************
* - Add a command to Shell environment : route_clock_rr_graph
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_route_clock_rr_graph_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " route_clock_rr_graph " ) ;
2023-03-07 15:13:25 -06:00
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file =
shell_cmd . add_option ( " pin_constraints_file " , false ,
" specify the file path to the pin constraints " ) ;
shell_cmd . set_option_short_name ( opt_file , " pcf " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
2023-02-28 13:52:38 -06:00
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'pb_pin_fixup' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd ,
" Route clock network based on routing resource graph built by VPR. " ,
hidden ) ;
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id ,
route_clock_rr_graph_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-06-18 01:42:45 -05:00
/********************************************************************
* - Add a command to Shell environment : add_fpga_core_to_fabric
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_add_fpga_core_to_fabric_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " add_fpga_core_to_fabric " ) ;
2023-06-21 16:01:00 -05:00
/* Add an option '--io_naming'*/
CommandOptionId opt_io_naming = shell_cmd . add_option (
" io_naming " , false , " specify the file path to the I/O naming rules " ) ;
shell_cmd . set_option_require_value ( opt_io_naming , openfpga : : OPT_STRING ) ;
2023-06-18 21:17:42 -05:00
/* Add an option '--instance_name'*/
CommandOptionId opt_inst_name = shell_cmd . add_option (
" instance_name " , false , " specify the instance of fpga_core under fpga_top " ) ;
shell_cmd . set_option_require_value ( opt_inst_name , openfpga : : OPT_STRING ) ;
/* Add an option '--verbose' */
shell_cmd . add_option (
" frame_view " , false ,
" Build only frame view of the fabric (nets are skipped) " ) ;
2023-06-18 01:42:45 -05:00
/* Add an option '--verbose' */
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command 'pb_pin_fixup' to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd ,
2023-06-18 21:17:42 -05:00
" Add fpga_core as an intermediate layer to FPGA fabric. After this "
" command, the fpga_top will remain the top-level module while there is a "
" new module fpga_core under it. Under fpga_core, there will be the "
" detailed building blocks " ,
2023-06-18 01:42:45 -05:00
hidden ) ;
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_execute_function ( shell_cmd_id ,
add_fpga_core_to_fabric_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-07-08 20:12:51 -05:00
/********************************************************************
* - Add a command to Shell environment : write_fabric_key
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_write_fabric_key_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " write_fabric_key " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file =
shell_cmd . add_option ( " file " , true , " file path to the fabric key XML " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
/* Add an option '--include_module_keys'*/
shell_cmd . add_option ( " include_module_keys " , false ,
" Include module-level keys " ) ;
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " write fabric key of the FPGA fabric to file " , hidden ) ;
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
shell . set_command_const_execute_function ( shell_cmd_id ,
write_fabric_key_template < T > ) ;
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-09-15 21:15:18 -05:00
/********************************************************************
* - Add a command to Shell environment : rename_modules
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_rename_modules_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " rename_modules " ) ;
/* Add an option '--file' in short '-f'*/
2023-09-16 01:32:40 -05:00
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the XML file that contains renaming rules " ) ;
2023-09-15 21:15:18 -05:00
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , openfpga : : OPT_STRING ) ;
shell_cmd . add_option ( " verbose " , false , " Show verbose outputs " ) ;
/* Add command to the Shell */
ShellCommandId shell_cmd_id = shell . add_command (
shell_cmd , " Rename modules with a set of given rules " , hidden ) ;
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-09-16 01:32:40 -05:00
shell . set_command_execute_function ( shell_cmd_id , rename_modules_template < T > ) ;
2023-09-15 21:15:18 -05:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-09-16 21:37:06 -05:00
/********************************************************************
* - Add a command to Shell environment : write_module_naming_rules
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
ShellCommandId add_write_module_naming_rules_command_template (
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
Command shell_cmd ( " write_module_naming_rules " ) ;
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
" file " , true , " file path to the XML file that contains renaming rules " ) ;
shell_cmd . set_option_short_name ( opt_file , " f " ) ;
shell_cmd . set_option_require_value ( opt_file , 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 (
2023-09-17 15:29:30 -05:00
shell_cmd ,
" Output the naming rules for each module of an FPGA fabric to a given file " ,
hidden ) ;
2023-09-16 21:37:06 -05:00
shell . set_command_class ( shell_cmd_id , cmd_class_id ) ;
2023-09-17 15:29:30 -05:00
shell . set_command_const_execute_function (
shell_cmd_id , write_module_naming_rules_template < T > ) ;
2023-09-16 21:37:06 -05:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2024-04-10 15:07:49 -05:00
/********************************************************************
* - Add a command to Shell environment : write_pin_physical_location
* - Add associated options
* - Add command dependency
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
template < class T >
2024-04-10 15:30:02 -05:00
ShellCommandId add_write_fabric_pin_physical_location_command_template (
2024-04-10 15:07:49 -05:00
openfpga : : Shell < T > & shell , const ShellCommandClassId & cmd_class_id ,
const std : : vector < ShellCommandId > & dependent_cmds , const bool & hidden ) {
2024-04-10 15:30:02 -05:00
Command shell_cmd ( " write_fabric_pin_physical_location " ) ;
2024-04-10 15:07:49 -05:00
/* Add an option '--file' in short '-f'*/
CommandOptionId opt_file = shell_cmd . add_option (
2024-04-11 00:53:52 -05:00
" file " , true ,
" file path to the XML file that contains pin physical location " ) ;
2024-04-10 15:07:49 -05:00
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 (
2024-04-11 00:53:52 -05:00
" module " , false ,
" specify the module whose pin physical location should be outputted " ) ;
2024-04-10 15:07:49 -05:00
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 " ) ;
2024-04-11 00:53:52 -05:00
shell_cmd . add_option (
" show_invalid_side " , false ,
" Include pins with invalid sides in output files. Recommended for "
" debugging as the output file may include a lot of useless information " ) ;
2024-04-11 00:52:36 -05:00
2024-04-10 15:07:49 -05:00
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 (
2024-04-10 15:30:02 -05:00
shell_cmd_id , write_fabric_pin_physical_location_template < T > ) ;
2024-04-10 15:07:49 -05:00
/* Add command dependency to the Shell */
shell . set_command_dependency ( shell_cmd_id , dependent_cmds ) ;
return shell_cmd_id ;
}
2023-01-06 23:11:12 -06:00
template < class T >
2023-01-07 13:40:17 -06:00
void add_setup_command_templates ( openfpga : : Shell < T > & shell ,
const bool & hidden = false ) {
2023-01-06 22:52:37 -06:00
/* Get the unique id of 'vpr' command which is to be used in creating the
* dependency graph */
const ShellCommandId & vpr_cmd_id = shell . command ( std : : string ( " vpr " ) ) ;
/* Add a new class of commands */
ShellCommandClassId openfpga_setup_cmd_class =
shell . add_command_class ( " OpenFPGA setup " ) ;
/********************************
* Command ' pcf2place '
*/
2023-01-07 13:18:43 -06:00
add_pcf2place_command_template < T > ( shell , openfpga_setup_cmd_class , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' read_openfpga_arch '
*/
2023-01-07 13:40:17 -06:00
ShellCommandId read_arch_cmd_id = add_read_openfpga_arch_command_template < T > (
shell , openfpga_setup_cmd_class , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' write_openfpga_arch '
*/
/* The 'write_openfpga_arch' command should NOT be executed before
* ' read_openfpga_arch ' */
std : : vector < ShellCommandId > write_arch_dependent_cmds ( 1 , read_arch_cmd_id ) ;
2023-01-07 13:40:17 -06:00
add_write_openfpga_arch_command_template < T > (
shell , openfpga_setup_cmd_class , write_arch_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' read_openfpga_simulation_setting '
*/
ShellCommandId read_sim_setting_cmd_id =
2023-01-07 13:40:17 -06:00
add_read_simulation_setting_command_template < T > (
shell , openfpga_setup_cmd_class , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' write_openfpga_simulation_setting '
*/
/* The 'write_openfpga_simulation_setting' command should NOT be executed
* before ' read_openfpga_simulation_setting ' */
std : : vector < ShellCommandId > write_sim_setting_dependent_cmds (
1 , read_sim_setting_cmd_id ) ;
add_write_simulation_setting_command_template < T > (
2023-01-07 13:18:43 -06:00
shell , openfpga_setup_cmd_class , write_sim_setting_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' read_openfpga_bitstream_setting '
*/
ShellCommandId read_bitstream_setting_cmd_id =
2023-01-07 13:40:17 -06:00
add_read_bitstream_setting_command_template < T > (
shell , openfpga_setup_cmd_class , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' write_openfpga_bitstream_setting '
*/
/* The 'write_openfpga_bitstream_setting' command should NOT be executed
* before ' read_openfpga_bitstream_setting ' */
std : : vector < ShellCommandId > write_bitstream_setting_dependent_cmds (
1 , read_bitstream_setting_cmd_id ) ;
add_write_bitstream_setting_command_template < T > (
2023-01-07 13:40:17 -06:00
shell , openfpga_setup_cmd_class , write_bitstream_setting_dependent_cmds ,
hidden ) ;
2023-01-06 22:52:37 -06:00
2023-02-22 23:58:25 -06:00
/********************************
* Command ' read_openfpga_clock_arch '
*/
std : : vector < ShellCommandId > read_openfpga_clock_arch_dependent_cmds ;
read_openfpga_clock_arch_dependent_cmds . push_back ( vpr_cmd_id ) ;
read_openfpga_clock_arch_dependent_cmds . push_back ( read_arch_cmd_id ) ;
ShellCommandId read_openfpga_clock_arch_cmd_id =
add_read_openfpga_clock_arch_command_template < T > (
2023-02-23 00:01:24 -06:00
shell , openfpga_setup_cmd_class , read_openfpga_clock_arch_dependent_cmds ,
hidden ) ;
2023-02-22 23:58:25 -06:00
/********************************
* Command ' write_openfpga_clock_arch '
*/
/* The 'write_openfpga_clock_arch' command should NOT be executed
* before ' read_openfpga_clock_arch ' */
std : : vector < ShellCommandId > write_openfpga_clock_arch_dependent_cmds (
1 , read_openfpga_clock_arch_cmd_id ) ;
add_write_openfpga_clock_arch_command_template < T > (
shell , openfpga_setup_cmd_class , write_openfpga_clock_arch_dependent_cmds ,
hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' link_openfpga_arch '
*/
/* The 'link_openfpga_arch' command should NOT be executed before 'vpr' */
std : : vector < ShellCommandId > link_arch_dependent_cmds ;
link_arch_dependent_cmds . push_back ( read_arch_cmd_id ) ;
/* TODO: This will be uncommented when openfpga flow script is updated
*/
link_arch_dependent_cmds . push_back ( read_sim_setting_cmd_id ) ;
link_arch_dependent_cmds . push_back ( vpr_cmd_id ) ;
ShellCommandId link_arch_cmd_id = add_link_arch_command_template < T > (
2023-01-07 13:18:43 -06:00
shell , openfpga_setup_cmd_class , link_arch_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
2023-02-23 15:30:18 -06:00
/********************************
* Command ' append_clock_rr_graph '
*/
/* The 'append_clock_rr_graph' command should NOT be executed before
* ' read_openfpga_clock_arch ' */
std : : vector < ShellCommandId > append_clock_rr_graph_dependent_cmds ;
2023-02-24 21:15:39 -06:00
append_clock_rr_graph_dependent_cmds . push_back (
read_openfpga_clock_arch_cmd_id ) ;
add_append_clock_rr_graph_command_template < T > (
shell , openfpga_setup_cmd_class , append_clock_rr_graph_dependent_cmds ,
hidden ) ;
2023-02-23 15:30:18 -06:00
2023-02-28 13:52:38 -06:00
/********************************
* Command ' route_clock_rr_graph '
*/
/* The 'route_clock_rr_graph' command should NOT be executed before
* ' read_openfpga_clock_arch ' and ' link_arch ' */
std : : vector < ShellCommandId > route_clock_rr_graph_dependent_cmds ;
route_clock_rr_graph_dependent_cmds . push_back (
read_openfpga_clock_arch_cmd_id ) ;
route_clock_rr_graph_dependent_cmds . push_back ( link_arch_cmd_id ) ;
add_route_clock_rr_graph_command_template < T > (
shell , openfpga_setup_cmd_class , route_clock_rr_graph_dependent_cmds ,
hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' write_gsb '
*/
/* The 'write_gsb' command should NOT be executed before 'link_openfpga_arch'
*/
std : : vector < ShellCommandId > write_gsb_dependent_cmds ;
write_gsb_dependent_cmds . push_back ( link_arch_cmd_id ) ;
add_write_gsb_command_template < T > ( shell , openfpga_setup_cmd_class ,
2023-01-07 13:18:43 -06:00
write_gsb_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/*******************************************
* Command ' check_netlist_naming_conflict '
*/
/* The 'check_netlist_naming_conflict' command should NOT be executed before
* ' vpr ' */
std : : vector < ShellCommandId > nlist_naming_dependent_cmds ;
nlist_naming_dependent_cmds . push_back ( vpr_cmd_id ) ;
add_check_netlist_naming_conflict_command_template < T > (
2023-01-07 13:18:43 -06:00
shell , openfpga_setup_cmd_class , nlist_naming_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' pb_pin_fixup '
*/
/* The 'pb_pin_fixup' command should NOT be executed before
* ' read_openfpga_arch ' and ' vpr ' */
std : : vector < ShellCommandId > pb_pin_fixup_dependent_cmds ;
pb_pin_fixup_dependent_cmds . push_back ( read_arch_cmd_id ) ;
pb_pin_fixup_dependent_cmds . push_back ( vpr_cmd_id ) ;
add_pb_pin_fixup_command_template < T > ( shell , openfpga_setup_cmd_class ,
2023-01-07 13:18:43 -06:00
pb_pin_fixup_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' lut_truth_table_fixup '
*/
/* The 'lut_truth_table_fixup' command should NOT be executed before
* ' read_openfpga_arch ' and ' vpr ' */
std : : vector < ShellCommandId > lut_tt_fixup_dependent_cmds ;
lut_tt_fixup_dependent_cmds . push_back ( read_arch_cmd_id ) ;
lut_tt_fixup_dependent_cmds . push_back ( vpr_cmd_id ) ;
2023-01-07 13:40:17 -06:00
add_lut_truth_table_fixup_command_template < T > (
shell , openfpga_setup_cmd_class , lut_tt_fixup_dependent_cmds , hidden ) ;
2023-06-18 01:42:45 -05:00
2023-01-06 22:52:37 -06:00
/********************************
* Command ' build_fabric '
*/
/* The 'build_fabric' command should NOT be executed before
* ' link_openfpga_arch ' */
std : : vector < ShellCommandId > build_fabric_dependent_cmds ;
build_fabric_dependent_cmds . push_back ( link_arch_cmd_id ) ;
ShellCommandId build_fabric_cmd_id = add_build_fabric_command_template < T > (
2023-01-07 13:18:43 -06:00
shell , openfpga_setup_cmd_class , build_fabric_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
2023-06-18 01:42:45 -05:00
/********************************
* Command ' add_fpga_core_to_fabric '
*/
/* The command should NOT be executed before
* ' build_fabric ' */
std : : vector < ShellCommandId > add_fpga_core_to_fabric_dependent_cmds ;
add_fpga_core_to_fabric_dependent_cmds . push_back ( build_fabric_cmd_id ) ;
2023-06-19 15:01:43 -05:00
add_add_fpga_core_to_fabric_command_template < T > (
shell , openfpga_setup_cmd_class , add_fpga_core_to_fabric_dependent_cmds ,
hidden ) ;
2023-06-18 01:42:45 -05:00
2023-07-08 20:12:51 -05:00
/********************************
* Command ' write_fabric_key '
*/
/* The 'write_fabric_key' command should NOT be executed before
* ' build_fabric ' */
std : : vector < ShellCommandId > write_fabric_key_dependent_cmds ;
write_fabric_key_dependent_cmds . push_back ( build_fabric_cmd_id ) ;
add_write_fabric_key_command_template < T > (
shell , openfpga_setup_cmd_class , write_fabric_key_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' write_fabric_hierarchy '
*/
/* The 'write_fabric_hierarchy' command should NOT be executed before
* ' build_fabric ' */
std : : vector < ShellCommandId > write_fabric_hie_dependent_cmds ;
write_fabric_hie_dependent_cmds . push_back ( build_fabric_cmd_id ) ;
2023-01-06 23:11:12 -06:00
add_write_fabric_hierarchy_command_template < T > (
2023-01-07 13:18:43 -06:00
shell , openfpga_setup_cmd_class , write_fabric_hie_dependent_cmds , hidden ) ;
2023-01-06 22:52:37 -06:00
/********************************
* Command ' write_fabric_io_info '
*/
/* The 'write_fabric_io_info' command should NOT be executed before
* ' build_fabric ' */
std : : vector < ShellCommandId > cmd_dependency_write_fabric_io_info ;
cmd_dependency_write_fabric_io_info . push_back ( build_fabric_cmd_id ) ;
add_write_fabric_io_info_command_template < T > (
2023-01-07 13:40:17 -06:00
shell , openfpga_setup_cmd_class , cmd_dependency_write_fabric_io_info ,
hidden ) ;
2023-09-15 21:15:18 -05:00
/********************************
* Command ' rename_modules '
*/
/* The 'rename_modules' command should NOT be executed before
* ' build_fabric ' */
std : : vector < ShellCommandId > cmd_dependency_rename_modules ;
cmd_dependency_rename_modules . push_back ( build_fabric_cmd_id ) ;
2023-09-16 01:32:40 -05:00
add_rename_modules_command_template < T > ( shell , openfpga_setup_cmd_class ,
cmd_dependency_rename_modules , hidden ) ;
2023-09-16 21:37:06 -05:00
/********************************
* Command ' write_module_naming_rules '
*/
/* The 'write_module_naming_rules' command should NOT be executed before
* ' build_fabric ' */
std : : vector < ShellCommandId > cmd_dependency_write_module_naming_rules ;
cmd_dependency_write_module_naming_rules . push_back ( build_fabric_cmd_id ) ;
2023-09-17 15:29:30 -05:00
add_write_module_naming_rules_command_template < T > (
shell , openfpga_setup_cmd_class , cmd_dependency_write_module_naming_rules ,
hidden ) ;
2024-04-10 15:07:49 -05:00
/********************************
2024-04-10 15:30:02 -05:00
* Command ' write_fabric_pin_physical_location '
2024-04-10 15:07:49 -05:00
*/
/* The command should NOT be executed before 'build_fabric' */
2024-04-10 15:30:02 -05:00
std : : vector < ShellCommandId > cmd_dependency_write_fabric_pin_physical_location ;
2024-04-11 00:53:52 -05:00
cmd_dependency_write_fabric_pin_physical_location . push_back (
build_fabric_cmd_id ) ;
2024-04-10 15:30:02 -05:00
add_write_fabric_pin_physical_location_command_template < T > (
2024-04-11 00:53:52 -05:00
shell , openfpga_setup_cmd_class ,
cmd_dependency_write_fabric_pin_physical_location , hidden ) ;
2023-01-06 22:52:37 -06:00
}
} /* end namespace openfpga */
# endif