Skip to content

Commit

Permalink
add option reduce error to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
treelin611 committed Oct 31, 2024
1 parent f4b087a commit 539e371
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ pcf2place
.. option:: --no_time_stamp

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

Expand Down
22 changes: 11 additions & 11 deletions libs/libpcf/src/io/pcf_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ constexpr const char COMMENT = '#';
* Return 1 if there are serious errors when parsing data
* 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));

/* Create a file handler */
Expand Down Expand Up @@ -57,17 +58,16 @@ int read_pcf(const char* fname, PcfData& pcf_data) {
pcf_data.set_io_pin(io_id, pin_name);
} else if (word[0] == COMMENT) { // if it's a comment
break; // or ignore the full line comment and move on
} else if (word.find("set_clk") == 0 || word.find("set_reset") == 0) {
/* set_clk and set_rest are known commands for Arkangel, disable the
* error message for these two commands when call read_pcf function
*/
break;
} else {
/* Reach unknown command for OpenFpga, error out */
VTR_LOG_ERROR("Unknown command '%s'!\n", word.c_str());
num_err++;
break; // and move onto next line. without this, it will accept
// more following values on this line
if (reduce_error_to_warning) {
break;
} else {
/* Reach unknown command for OpenFpga, error out */
VTR_LOG_ERROR("Unknown command '%s'!\n", word.c_str());
num_err++;
break; // and move onto next line. without this, it will accept
// more following values on this line
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/libpcf/src/io/pcf_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace openfpga {

/* Parse a .pcf file through a stream, return an object which contains all the
* 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*/

Expand Down
4 changes: 3 additions & 1 deletion openfpga/src/base/openfpga_pcf2place_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ int pcf2place_wrapper_template(const Command& cmd,
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
CommandOptionId opt_pin_table_dir_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");

std::string pcf_fname = cmd_context.option_value(cmd, opt_pcf);
Expand Down Expand Up @@ -71,7 +73,7 @@ int pcf2place_wrapper_template(const Command& cmd,

/* Parse the input files */
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",
pcf_fname.c_str());

Expand Down
4 changes: 4 additions & 0 deletions openfpga/src/base/openfpga_setup_command_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ ShellCommandId add_pcf2place_command_template(
shell_cmd.add_option("no_time_stamp", false,
"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' */
shell_cmd.add_option("verbose", false, "Enable verbose output");

Expand Down

0 comments on commit 539e371

Please sign in to comment.