Fix typos

This commit is contained in:
Eddie Hung 2019-08-06 19:07:45 -07:00
parent e5be9ff871
commit 234fcf1724
3 changed files with 9 additions and 9 deletions

View File

@ -828,7 +828,7 @@ namespace {
void check() void check()
{ {
if (cell->type.begins_with("$") || cell->type.begins_with("$__") || cell->type.begins_with("$paramod") || cell->type.begins_with("$fmcombine") || if (!cell->type.begins_with("$") || cell->type.begins_with("$__") || cell->type.begins_with("$paramod") || cell->type.begins_with("$fmcombine") ||
cell->type.begins_with("$verific$") || cell->type.begins_with("$array:") || cell->type.begins_with("$extern:")) cell->type.begins_with("$verific$") || cell->type.begins_with("$array:") || cell->type.begins_with("$extern:"))
return; return;
@ -2553,7 +2553,7 @@ void RTLIL::Cell::check()
void RTLIL::Cell::fixup_parameters(bool set_a_signed, bool set_b_signed) void RTLIL::Cell::fixup_parameters(bool set_a_signed, bool set_b_signed)
{ {
if (type.begins_with("$") || type.begins_with("$_") || type.begins_with("$paramod") || type.begins_with("$fmcombine") || if (!type.begins_with("$") || type.begins_with("$_") || type.begins_with("$paramod") || type.begins_with("$fmcombine") ||
type.begins_with("$verific$") || type.begins_with("$array:") || type.begins_with("$extern:")) type.begins_with("$verific$") || type.begins_with("$array:") || type.begins_with("$extern:"))
return; return;

View File

@ -283,13 +283,13 @@ namespace RTLIL
bool begins_with(const char* prefix) const { bool begins_with(const char* prefix) const {
size_t len = strlen(prefix); size_t len = strlen(prefix);
if (size() < len) return false; if (size() < len) return false;
return compare(0, len, prefix); return compare(0, len, prefix) == 0;
} }
bool ends_with(const char* suffix) const { bool ends_with(const char* suffix) const {
size_t len = strlen(suffix); size_t len = strlen(suffix);
if (size() < len) return false; if (size() < len) return false;
return compare(size()-len, len, suffix); return compare(size()-len, len, suffix) == 0;
} }
size_t size() const { size_t size() const {

View File

@ -143,7 +143,7 @@ void generate(RTLIL::Design *design, const std::vector<std::string> &celltypes,
// Return the "basic" type for an array item. // Return the "basic" type for an array item.
std::string basic_cell_type(const std::string celltype, int pos[3] = nullptr) { std::string basic_cell_type(const std::string celltype, int pos[3] = nullptr) {
std::string basicType = celltype; std::string basicType = celltype;
if (celltype.compare(0, strlen("$array:"), "$array:")) { if (celltype.compare(0, strlen("$array:"), "$array:") == 0) {
int pos_idx = celltype.find_first_of(':'); int pos_idx = celltype.find_first_of(':');
int pos_num = celltype.find_first_of(':', pos_idx + 1); int pos_num = celltype.find_first_of(':', pos_idx + 1);
int pos_type = celltype.find_first_of(':', pos_num + 1); int pos_type = celltype.find_first_of(':', pos_num + 1);
@ -200,8 +200,8 @@ bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool flag_check
int pos_idx = pos[0]; int pos_idx = pos[0];
int pos_num = pos[1]; int pos_num = pos[1];
int pos_type = pos[2]; int pos_type = pos[2];
int idx = std::stoi(cell->type.str().substr(pos_idx + 1, pos_num)); int idx = std::stoi(cell->type.substr(pos_idx + 1, pos_num));
int num = std::stoi(cell->type.str().substr(pos_num + 1, pos_type)); int num = std::stoi(cell->type.substr(pos_num + 1, pos_type));
array_cells[cell] = std::pair<int, int>(idx, num); array_cells[cell] = std::pair<int, int>(idx, num);
cell->type = cell->type.str().substr(pos_type + 1); cell->type = cell->type.str().substr(pos_type + 1);
} }
@ -457,7 +457,7 @@ void hierarchy_worker(RTLIL::Design *design, std::set<RTLIL::Module*, IdString::
for (auto cell : mod->cells()) { for (auto cell : mod->cells()) {
std::string celltype = cell->type.str(); std::string celltype = cell->type.str();
if (celltype.compare(0, strlen("$array:"), "$array:")) if (celltype.compare(0, strlen("$array:"), "$array:") == 0)
celltype = basic_cell_type(celltype); celltype = basic_cell_type(celltype);
if (design->module(celltype)) if (design->module(celltype))
hierarchy_worker(design, used, design->module(celltype), indent+4); hierarchy_worker(design, used, design->module(celltype), indent+4);
@ -520,7 +520,7 @@ int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)
for (auto cell : module->cells()) { for (auto cell : module->cells()) {
std::string celltype = cell->type.str(); std::string celltype = cell->type.str();
// Is this an array instance // Is this an array instance
if (celltype.compare(0, strlen("$array:"), "$array:")) if (celltype.compare(0, strlen("$array:"), "$array:") == 0)
celltype = basic_cell_type(celltype); celltype = basic_cell_type(celltype);
// Is this cell a module instance? // Is this cell a module instance?
auto instModule = design->module(celltype); auto instModule = design->module(celltype);