add option reduce error to warning

This commit is contained in:
Lin 2024-10-31 10:47:26 +08:00
parent f4b087a3a7
commit 539e37118a
5 changed files with 23 additions and 13 deletions

View File

@ -461,6 +461,10 @@ pcf2place
Do not print time stamp in output files Do not print time stamp in output files
.. option:: --reduce_error_to_warning
Reduce error to warning while reading commands in pcf file
.. option:: --verbose .. option:: --verbose
Show verbose log Show verbose log

View File

@ -27,7 +27,8 @@ constexpr const char COMMENT = '#';
* Return 1 if there are serious errors when parsing data * Return 1 if there are serious errors when parsing data
* Return 2 if fail when opening files * Return 2 if fail when opening files
*******************************************************************/ *******************************************************************/
int read_pcf(const char* fname, PcfData& pcf_data) { int read_pcf(const char* fname, PcfData& pcf_data,
bool reduce_error_to_warning = false) {
vtr::ScopedStartFinishTimer timer("Read " + std::string(fname)); vtr::ScopedStartFinishTimer timer("Read " + std::string(fname));
/* Create a file handler */ /* Create a file handler */
@ -57,10 +58,8 @@ int read_pcf(const char* fname, PcfData& pcf_data) {
pcf_data.set_io_pin(io_id, pin_name); pcf_data.set_io_pin(io_id, pin_name);
} else if (word[0] == COMMENT) { // if it's a comment } else if (word[0] == COMMENT) { // if it's a comment
break; // or ignore the full line comment and move on break; // or ignore the full line comment and move on
} else if (word.find("set_clk") == 0 || word.find("set_reset") == 0) { } else {
/* set_clk and set_rest are known commands for Arkangel, disable the if (reduce_error_to_warning) {
* error message for these two commands when call read_pcf function
*/
break; break;
} else { } else {
/* Reach unknown command for OpenFpga, error out */ /* Reach unknown command for OpenFpga, error out */
@ -72,6 +71,7 @@ int read_pcf(const char* fname, PcfData& pcf_data) {
} }
} }
} }
}
if (num_err) { if (num_err) {
return 1; return 1;

View File

@ -16,7 +16,7 @@ namespace openfpga {
/* Parse a .pcf file through a stream, return an object which contains all the /* Parse a .pcf file through a stream, return an object which contains all the
* data */ * data */
int read_pcf(const char* fname, PcfData& pcf_data); int read_pcf(const char* fname, PcfData& pcf_data, bool reduce_error_to_warning = false);
} /* End namespace openfpga*/ } /* End namespace openfpga*/

View File

@ -35,6 +35,8 @@ int pcf2place_wrapper_template(const Command& cmd,
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp"); CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
CommandOptionId opt_pin_table_dir_convention = CommandOptionId opt_pin_table_dir_convention =
cmd.option("pin_table_direction_convention"); cmd.option("pin_table_direction_convention");
CommandOptionId opt_reduce_error_to_warning =
cmd.option("reduce_error_to_warning");
CommandOptionId opt_verbose = cmd.option("verbose"); CommandOptionId opt_verbose = cmd.option("verbose");
std::string pcf_fname = cmd_context.option_value(cmd, opt_pcf); std::string pcf_fname = cmd_context.option_value(cmd, opt_pcf);
@ -71,7 +73,7 @@ int pcf2place_wrapper_template(const Command& cmd,
/* Parse the input files */ /* Parse the input files */
openfpga::PcfData pcf_data; openfpga::PcfData pcf_data;
openfpga::read_pcf(pcf_fname.c_str(), pcf_data); openfpga::read_pcf(pcf_fname.c_str(), pcf_data,cmd_context.option_enable(cmd, opt_reduce_error_to_warning));
VTR_LOG("Read the design constraints from a pcf file: %s.\n", VTR_LOG("Read the design constraints from a pcf file: %s.\n",
pcf_fname.c_str()); pcf_fname.c_str());

View File

@ -599,6 +599,10 @@ ShellCommandId add_pcf2place_command_template(
shell_cmd.add_option("no_time_stamp", false, shell_cmd.add_option("no_time_stamp", false,
"Do not print time stamp in output files"); "Do not print time stamp in output files");
/* Add an option '--reduce_error_to_warning' */
shell_cmd.add_option("reduce_error_to_warning", false,
"reduce error to warning while reading commands in pcf file");
/* Add an option '--verbose' */ /* Add an option '--verbose' */
shell_cmd.add_option("verbose", false, "Enable verbose output"); shell_cmd.add_option("verbose", false, "Enable verbose output");