[core] syntax

This commit is contained in:
tangxifan 2023-10-06 14:07:44 -07:00
parent 4b73a124ce
commit 108bbad8d4
2 changed files with 23 additions and 16 deletions

View File

@ -32,7 +32,7 @@ BitstreamWriterOption::BitstreamWriterOption() {
/**************************************************
* Public Accessors
*************************************************/
BitstreamWriterOption::e_bitfile_type output_file_type() const {
BitstreamWriterOption::e_bitfile_type BitstreamWriterOption::output_file_type() const {
return file_type_;
}
@ -44,21 +44,21 @@ bool BitstreamWriterOption::time_stamp() const { return time_stamp_; }
bool BitstreamWriterOption::verbose_output() const { return verbose_output_; }
bool BitstreamWriterOption:filter_value() const {
bool BitstreamWriterOption::filter_value() const {
return !filter_value_.empty();
}
bool BitstreamWriterOption:value_to_skip(const size_t& val) const {
bool BitstreamWriterOption::value_to_skip(const size_t& val) const {
return std::to_string(val) == filter_value_;
}
bool trim_path() const { return trim_path_; }
bool output_path() const { return path_only_; }
bool output_value() const { return value_only_; }
bool BitstreamWriterOption::trim_path() const { return trim_path_; }
bool BitstreamWriterOption::output_path() const { return path_only_; }
bool BitstreamWriterOption::output_value() const { return value_only_; }
bool fast_configuration() const { return fast_config_; }
bool keep_dont_care_bits() const { return keep_dont_care_bits_; }
bool wl_decremental_order() const { return wl_decremental_order_; }
bool BitstreamWriterOption::fast_configuration() const { return fast_config_; }
bool BitstreamWriterOption::keep_dont_care_bits() const { return keep_dont_care_bits_; }
bool BitstreamWriterOption::wl_decremental_order() const { return wl_decremental_order_; }
/******************************************************************************
* Private Mutators
@ -119,7 +119,7 @@ bool BitstreamWriterOption::validate(bool show_err_msg) const {
}
if (file_type_ == BitstreamWriterOption::e_bitfile_type::XML) {
/* All the options in the XML format should be off */
if (path_only_ && value_only) {
if (path_only_ && value_only_) {
VTR_LOGV_ERROR(show_err_msg, "Both path and value are specifed as only inputs! If specified, please define one of them\n");
return false;
}
@ -131,11 +131,11 @@ bool BitstreamWriterOption::validate(bool show_err_msg) const {
return true;
}
e_bitfile_type BitstreamWriterOption::str2bitfile_type(const std::string& type_str, const bool& verbose) const {
BitstreamWriterOption::e_bitfile_type BitstreamWriterOption::str2bitfile_type(const std::string& type_str, const bool& verbose) const {
for (int itype = size_t(BitstreamWriterOption::e_bitfile_type::TEXT);
itype != size_t(BitstreamWriterOption::e_bitfile_type::NUM_TYPES); ++itype) {
if (type_str == std::string(BITFILE_TYPE_STRING_[itype])) {
return static_cast<BitstreamWriterOption::e_bitfile_type::>(itype);
return static_cast<BitstreamWriterOption::e_bitfile_type>(itype);
}
}
VTR_LOGV_ERROR(verbose, "Invalid type for bitstream file! Expect %s\n",
@ -147,13 +147,13 @@ std::string BitstreamWriterOption::bitfile_type2str(const BitstreamWriterOption:
const bool& verbose) const {
if (!valid_file_type(type)) {
VTR_LOGV_ERROR(verbose, "Invalid type for bitstream file! Expect %s\n",
file_type_all2str().c_str());
bitfile_type_all2str().c_str());
return std::string();
}
return std::string(BITFILE_TYPE_STRING_[size_t(type)]);
}
std::string BitstreamWriterOption::file_type_all2str() const {
std::string BitstreamWriterOption::bitfile_type_all2str() const {
std::string full_types = "[";
for (int itype = size_t(BitstreamWriterOption::e_bitfile_type::TEXT);
itype != size_t(BitstreamWriterOption::e_bitfile_type::NUM_TYPES); ++itype) {
@ -165,7 +165,7 @@ std::string BitstreamWriterOption::file_type_all2str() const {
}
bool BitstreamWriterOption::valid_file_type(const BitstreamWriterOption::e_bitfile_type bitfile_type) const {
bool BitstreamWriterOption::valid_file_type(const BitstreamWriterOption::e_bitfile_type& bitfile_type) const {
return bitfile_type != BitstreamWriterOption::e_bitfile_type::NUM_TYPES;
}

View File

@ -5,6 +5,7 @@
* Include header files required by the data structure definition
*******************************************************************/
#include <string>
#include <array>
/* Begin namespace openfpga */
namespace openfpga {
@ -50,6 +51,12 @@ class BitstreamWriterOption {
void set_output_file_name(const std::string& output_file);
void set_time_stamp(const bool& enabled);
void set_verbose_output(const bool& enabled);
void set_trim_path(const bool& enabled);
void set_path_only(const bool& enabled);
void set_value_only(const bool& enabled);
void set_fast_configuration(const bool& enabled);
void set_keep_dont_care_bits(const bool& enabled);
void set_wl_decremental_order(const bool& enabled);
void set_filter_value(const std::string& val);
@ -70,7 +77,7 @@ class BitstreamWriterOption {
/* Generate a string include all the valid style
* Useful for printing debugging messages */
std::string file_type_all2str() const;
std::string bitfile_type_all2str() const;
private: /* Internal Data */
/* Universal options */