[engine] enabling new feature: pin_table_direction_convention

This commit is contained in:
tangxifan 2022-10-17 14:08:21 -07:00
parent aef94171c2
commit 11624cd0c6
4 changed files with 23 additions and 3 deletions

View File

@ -16,7 +16,7 @@ int main(int argc, const char** argv) {
VTR_ASSERT((2 == argc) || (3 == argc));
/* Parse the fabric key from an XML file */
openfpga::IoPinTable io_pin_table = openfpga::read_csv_io_pin_table(argv[1]);
openfpga::IoPinTable io_pin_table = openfpga::read_csv_io_pin_table(argv[1], openfpga::e_pin_table_direction_convention::QUICKLOGIC);
VTR_LOG("Read the I/O pin table from a csv file: %s.\n", argv[1]);
/* Output to an XML file

View File

@ -43,7 +43,7 @@ int main(int argc, const char** argv) {
VTR_LOG("Read the I/O location map from an XML file: %s.\n", argv[3]);
openfpga::IoPinTable io_pin_table = openfpga::read_csv_io_pin_table(argv[4]);
VTR_LOG("Read the I/O pin table from a csv file: %s.\n", argv[4]);
VTR_LOG("Read the I/O pin table from a csv file: %s.\n", argv[4], openfpga::e_pin_table_direction_convention::QUICKLOGIC);
/* Convert */
openfpga::IoNetPlace io_net_place;

View File

@ -36,6 +36,7 @@ int pcf2place_wrapper(const OpenfpgaContext& openfpga_context,
CommandOptionId opt_pin_table = cmd.option("pin_table");
CommandOptionId opt_fpga_fix_pins = cmd.option("fpga_fix_pins");
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
CommandOptionId opt_pin_table_dir_convention = cmd.option("pin_table_direction_convention");
CommandOptionId opt_verbose = cmd.option("verbose");
std::string pcf_fname = cmd_context.option_value(cmd, opt_pcf);
@ -45,6 +46,18 @@ int pcf2place_wrapper(const OpenfpgaContext& openfpga_context,
std::string pin_table_fname = cmd_context.option_value(cmd, opt_pin_table);
std::string fpga_fix_pins_fname =
cmd_context.option_value(cmd, opt_fpga_fix_pins);
e_pin_table_direction_convention pin_table_dir_convention = e_pin_table_direction_convention::EXPLICIT;
if (cmd_context.option_enable(cmd, opt_pin_table_dir_convention)) {
std::string pin_table_dir_convention_str = cmd_context.option_value(cmd, opt_pin_table_dir_convention);
if (pin_table_dir_convention_str == std::string(PIN_TABLE_DIRECTION_CONVENTION_STRING[e_pin_table_direction_convention::EXPLICIT])) {
pin_table_dir_convention = e_pin_table_direction_convention::EXPLICIT;
} else if (pin_table_dir_convention_str == std::string(PIN_TABLE_DIRECTION_CONVENTION_STRING[e_pin_table_direction_convention::QUICKLOGIC])) {
pin_table_dir_convention = e_pin_table_direction_convention::QUICKLOGIC;
} else {
VTR_LOG_ERROR("Invalid pin naming convention ('%s') to identify port direction for pin table! Expect ['%s'|'%s'].\n",
pin_table_dir_convention_str.c_str(), PIN_TABLE_DIRECTION_CONVENTION_STRING[e_pin_table_direction_convention::EXPLICIT], PIN_TABLE_DIRECTION_CONVENTION_STRING[e_pin_table_direction_convention::QUICKLOGIC]);
}
}
/* Parse the input files */
openfpga::PcfData pcf_data;
@ -65,7 +78,7 @@ int pcf2place_wrapper(const OpenfpgaContext& openfpga_context,
VTR_LOG("Read the I/O location map from an XML file: %s.\n",
fpga_io_map_fname.c_str());
IoPinTable io_pin_table = read_csv_io_pin_table(pin_table_fname.c_str());
IoPinTable io_pin_table = read_csv_io_pin_table(pin_table_fname.c_str(), pin_table_dir_convention);
VTR_LOG("Read the I/O pin table from a csv file: %s.\n",
pin_table_fname.c_str());

View File

@ -528,6 +528,13 @@ static ShellCommandId add_openfpga_pcf2place_command(
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_fpga_fix_pins_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");