mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #5565 from rocallahan/idstring-by-value
Pass `IdString` by value instead of by const reference
This commit is contained in:
commit
650c18a2a2
|
|
@ -756,7 +756,7 @@ struct CxxrtlWorker {
|
||||||
// 1b. Generated identifiers for internal names (beginning with `$`) start with `i_`.
|
// 1b. Generated identifiers for internal names (beginning with `$`) start with `i_`.
|
||||||
// 2. An underscore is escaped with another underscore, i.e. `__`.
|
// 2. An underscore is escaped with another underscore, i.e. `__`.
|
||||||
// 3. Any other non-alnum character is escaped with underscores around its lowercase hex code, e.g. `@` as `_40_`.
|
// 3. Any other non-alnum character is escaped with underscores around its lowercase hex code, e.g. `@` as `_40_`.
|
||||||
std::string mangle_name(const RTLIL::IdString &name)
|
std::string mangle_name(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
std::string mangled;
|
std::string mangled;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
@ -786,7 +786,7 @@ struct CxxrtlWorker {
|
||||||
return mangled;
|
return mangled;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mangle_module_name(const RTLIL::IdString &name, bool is_blackbox = false)
|
std::string mangle_module_name(RTLIL::IdString name, bool is_blackbox = false)
|
||||||
{
|
{
|
||||||
// Class namespace.
|
// Class namespace.
|
||||||
if (is_blackbox)
|
if (is_blackbox)
|
||||||
|
|
@ -794,19 +794,19 @@ struct CxxrtlWorker {
|
||||||
return mangle_name(name);
|
return mangle_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mangle_memory_name(const RTLIL::IdString &name)
|
std::string mangle_memory_name(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
// Class member namespace.
|
// Class member namespace.
|
||||||
return "memory_" + mangle_name(name);
|
return "memory_" + mangle_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mangle_cell_name(const RTLIL::IdString &name)
|
std::string mangle_cell_name(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
// Class member namespace.
|
// Class member namespace.
|
||||||
return "cell_" + mangle_name(name);
|
return "cell_" + mangle_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mangle_wire_name(const RTLIL::IdString &name)
|
std::string mangle_wire_name(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
// Class member namespace.
|
// Class member namespace.
|
||||||
return mangle_name(name);
|
return mangle_name(name);
|
||||||
|
|
|
||||||
|
|
@ -879,7 +879,7 @@ static void check_auto_nosync(AstNode *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the attributes we've "consumed"
|
// remove the attributes we've "consumed"
|
||||||
for (const RTLIL::IdString &str : attrs_to_drop) {
|
for (RTLIL::IdString str : attrs_to_drop) {
|
||||||
auto it = node->attributes.find(str);
|
auto it = node->attributes.find(str);
|
||||||
node->attributes.erase(it);
|
node->attributes.erase(it);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -305,18 +305,18 @@ struct CellTypes
|
||||||
cell_types.clear();
|
cell_types.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cell_known(const RTLIL::IdString &type) const
|
bool cell_known(RTLIL::IdString type) const
|
||||||
{
|
{
|
||||||
return cell_types.count(type) != 0;
|
return cell_types.count(type) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cell_output(const RTLIL::IdString &type, const RTLIL::IdString &port) const
|
bool cell_output(RTLIL::IdString type, RTLIL::IdString port) const
|
||||||
{
|
{
|
||||||
auto it = cell_types.find(type);
|
auto it = cell_types.find(type);
|
||||||
return it != cell_types.end() && it->second.outputs.count(port) != 0;
|
return it != cell_types.end() && it->second.outputs.count(port) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cell_input(const RTLIL::IdString &type, const RTLIL::IdString &port) const
|
bool cell_input(RTLIL::IdString type, RTLIL::IdString port) const
|
||||||
{
|
{
|
||||||
auto it = cell_types.find(type);
|
auto it = cell_types.find(type);
|
||||||
return it != cell_types.end() && it->second.inputs.count(port) != 0;
|
return it != cell_types.end() && it->second.inputs.count(port) != 0;
|
||||||
|
|
@ -332,7 +332,7 @@ struct CellTypes
|
||||||
return RTLIL::PortDir(is_input + is_output * 2);
|
return RTLIL::PortDir(is_input + is_output * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cell_evaluable(const RTLIL::IdString &type) const
|
bool cell_evaluable(RTLIL::IdString type) const
|
||||||
{
|
{
|
||||||
auto it = cell_types.find(type);
|
auto it = cell_types.find(type);
|
||||||
return it != cell_types.end() && it->second.is_evaluable;
|
return it != cell_types.end() && it->second.is_evaluable;
|
||||||
|
|
|
||||||
|
|
@ -602,7 +602,7 @@ void format_emit_string_view(std::string &result, std::string_view spec, int *dy
|
||||||
}
|
}
|
||||||
|
|
||||||
void format_emit_idstring(std::string &result, std::string_view spec, int *dynamic_ints,
|
void format_emit_idstring(std::string &result, std::string_view spec, int *dynamic_ints,
|
||||||
DynamicIntCount num_dynamic_ints, const IdString &arg)
|
DynamicIntCount num_dynamic_ints, const RTLIL::IdString &arg)
|
||||||
{
|
{
|
||||||
if (spec == "%s") {
|
if (spec == "%s") {
|
||||||
// Format checking will have guaranteed num_dynamic_ints == 0.
|
// Format checking will have guaranteed num_dynamic_ints == 0.
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ struct ModIndex : public RTLIL::Monitor
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_connect(RTLIL::Cell *cell, const RTLIL::IdString &port, const RTLIL::SigSpec &old_sig, const RTLIL::SigSpec &sig) override
|
void notify_connect(RTLIL::Cell *cell, RTLIL::IdString port, const RTLIL::SigSpec &old_sig, const RTLIL::SigSpec &sig) override
|
||||||
{
|
{
|
||||||
log_assert(module == cell->module);
|
log_assert(module == cell->module);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1017,12 +1017,12 @@ RTLIL::Const RTLIL::Const::extract(int offset, int len, RTLIL::State padding) co
|
||||||
}
|
}
|
||||||
#undef check /* check(condition) for Const */
|
#undef check /* check(condition) for Const */
|
||||||
|
|
||||||
bool RTLIL::AttrObject::has_attribute(const RTLIL::IdString &id) const
|
bool RTLIL::AttrObject::has_attribute(RTLIL::IdString id) const
|
||||||
{
|
{
|
||||||
return attributes.count(id);
|
return attributes.count(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::AttrObject::set_bool_attribute(const RTLIL::IdString &id, bool value)
|
void RTLIL::AttrObject::set_bool_attribute(RTLIL::IdString id, bool value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
attributes[id] = RTLIL::Const(1);
|
attributes[id] = RTLIL::Const(1);
|
||||||
|
|
@ -1030,7 +1030,7 @@ void RTLIL::AttrObject::set_bool_attribute(const RTLIL::IdString &id, bool value
|
||||||
attributes.erase(id);
|
attributes.erase(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::AttrObject::get_bool_attribute(const RTLIL::IdString &id) const
|
bool RTLIL::AttrObject::get_bool_attribute(RTLIL::IdString id) const
|
||||||
{
|
{
|
||||||
const auto it = attributes.find(id);
|
const auto it = attributes.find(id);
|
||||||
if (it == attributes.end())
|
if (it == attributes.end())
|
||||||
|
|
@ -1038,7 +1038,7 @@ bool RTLIL::AttrObject::get_bool_attribute(const RTLIL::IdString &id) const
|
||||||
return it->second.as_bool();
|
return it->second.as_bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::AttrObject::set_string_attribute(const RTLIL::IdString& id, string value)
|
void RTLIL::AttrObject::set_string_attribute(RTLIL::IdString id, string value)
|
||||||
{
|
{
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
attributes.erase(id);
|
attributes.erase(id);
|
||||||
|
|
@ -1046,7 +1046,7 @@ void RTLIL::AttrObject::set_string_attribute(const RTLIL::IdString& id, string v
|
||||||
attributes[id] = value;
|
attributes[id] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
string RTLIL::AttrObject::get_string_attribute(const RTLIL::IdString &id) const
|
string RTLIL::AttrObject::get_string_attribute(RTLIL::IdString id) const
|
||||||
{
|
{
|
||||||
std::string value;
|
std::string value;
|
||||||
const auto it = attributes.find(id);
|
const auto it = attributes.find(id);
|
||||||
|
|
@ -1055,7 +1055,7 @@ string RTLIL::AttrObject::get_string_attribute(const RTLIL::IdString &id) const
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
|
void RTLIL::AttrObject::set_strpool_attribute(RTLIL::IdString id, const pool<string> &data)
|
||||||
{
|
{
|
||||||
string attrval;
|
string attrval;
|
||||||
for (const auto &s : data) {
|
for (const auto &s : data) {
|
||||||
|
|
@ -1066,7 +1066,7 @@ void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const p
|
||||||
set_string_attribute(id, attrval);
|
set_string_attribute(id, attrval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
|
void RTLIL::AttrObject::add_strpool_attribute(RTLIL::IdString id, const pool<string> &data)
|
||||||
{
|
{
|
||||||
pool<string> union_data = get_strpool_attribute(id);
|
pool<string> union_data = get_strpool_attribute(id);
|
||||||
union_data.insert(data.begin(), data.end());
|
union_data.insert(data.begin(), data.end());
|
||||||
|
|
@ -1074,7 +1074,7 @@ void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const p
|
||||||
set_strpool_attribute(id, union_data);
|
set_strpool_attribute(id, union_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
pool<string> RTLIL::AttrObject::get_strpool_attribute(const RTLIL::IdString &id) const
|
pool<string> RTLIL::AttrObject::get_strpool_attribute(RTLIL::IdString id) const
|
||||||
{
|
{
|
||||||
pool<string> data;
|
pool<string> data;
|
||||||
if (attributes.count(id) != 0)
|
if (attributes.count(id) != 0)
|
||||||
|
|
@ -1099,7 +1099,7 @@ vector<string> RTLIL::AttrObject::get_hdlname_attribute() const
|
||||||
return split_tokens(get_string_attribute(ID::hdlname), " ");
|
return split_tokens(get_string_attribute(ID::hdlname), " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::AttrObject::set_intvec_attribute(const RTLIL::IdString& id, const vector<int> &data)
|
void RTLIL::AttrObject::set_intvec_attribute(RTLIL::IdString id, const vector<int> &data)
|
||||||
{
|
{
|
||||||
std::stringstream attrval;
|
std::stringstream attrval;
|
||||||
for (auto &i : data) {
|
for (auto &i : data) {
|
||||||
|
|
@ -1110,7 +1110,7 @@ void RTLIL::AttrObject::set_intvec_attribute(const RTLIL::IdString& id, const ve
|
||||||
attributes[id] = RTLIL::Const(attrval.str());
|
attributes[id] = RTLIL::Const(attrval.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int> RTLIL::AttrObject::get_intvec_attribute(const RTLIL::IdString &id) const
|
vector<int> RTLIL::AttrObject::get_intvec_attribute(RTLIL::IdString id) const
|
||||||
{
|
{
|
||||||
vector<int> data;
|
vector<int> data;
|
||||||
auto it = attributes.find(id);
|
auto it = attributes.find(id);
|
||||||
|
|
@ -1128,7 +1128,7 @@ vector<int> RTLIL::AttrObject::get_intvec_attribute(const RTLIL::IdString &id) c
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Selection::boxed_module(const RTLIL::IdString &mod_name) const
|
bool RTLIL::Selection::boxed_module(RTLIL::IdString mod_name) const
|
||||||
{
|
{
|
||||||
if (current_design != nullptr) {
|
if (current_design != nullptr) {
|
||||||
auto module = current_design->module(mod_name);
|
auto module = current_design->module(mod_name);
|
||||||
|
|
@ -1139,7 +1139,7 @@ bool RTLIL::Selection::boxed_module(const RTLIL::IdString &mod_name) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Selection::selected_module(const RTLIL::IdString &mod_name) const
|
bool RTLIL::Selection::selected_module(RTLIL::IdString mod_name) const
|
||||||
{
|
{
|
||||||
if (complete_selection)
|
if (complete_selection)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1154,7 +1154,7 @@ bool RTLIL::Selection::selected_module(const RTLIL::IdString &mod_name) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Selection::selected_whole_module(const RTLIL::IdString &mod_name) const
|
bool RTLIL::Selection::selected_whole_module(RTLIL::IdString mod_name) const
|
||||||
{
|
{
|
||||||
if (complete_selection)
|
if (complete_selection)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1167,7 +1167,7 @@ bool RTLIL::Selection::selected_whole_module(const RTLIL::IdString &mod_name) co
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Selection::selected_member(const RTLIL::IdString &mod_name, const RTLIL::IdString &memb_name) const
|
bool RTLIL::Selection::selected_member(RTLIL::IdString mod_name, RTLIL::IdString memb_name) const
|
||||||
{
|
{
|
||||||
if (complete_selection)
|
if (complete_selection)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1294,12 +1294,12 @@ RTLIL::ObjRange<RTLIL::Module*> RTLIL::Design::modules()
|
||||||
return RTLIL::ObjRange<RTLIL::Module*>(&modules_, &refcount_modules_);
|
return RTLIL::ObjRange<RTLIL::Module*>(&modules_, &refcount_modules_);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLIL::Module *RTLIL::Design::module(const RTLIL::IdString& name)
|
RTLIL::Module *RTLIL::Design::module(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
return modules_.count(name) ? modules_.at(name) : NULL;
|
return modules_.count(name) ? modules_.at(name) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const RTLIL::Module *RTLIL::Design::module(const RTLIL::IdString& name) const
|
const RTLIL::Module *RTLIL::Design::module(RTLIL::IdString name) const
|
||||||
{
|
{
|
||||||
return modules_.count(name) ? modules_.at(name) : NULL;
|
return modules_.count(name) ? modules_.at(name) : NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1488,21 +1488,21 @@ void RTLIL::Design::optimize()
|
||||||
it.second.optimize(this);
|
it.second.optimize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Design::selected_module(const RTLIL::IdString& mod_name) const
|
bool RTLIL::Design::selected_module(RTLIL::IdString mod_name) const
|
||||||
{
|
{
|
||||||
if (!selected_active_module.empty() && mod_name != selected_active_module)
|
if (!selected_active_module.empty() && mod_name != selected_active_module)
|
||||||
return false;
|
return false;
|
||||||
return selection().selected_module(mod_name);
|
return selection().selected_module(mod_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Design::selected_whole_module(const RTLIL::IdString& mod_name) const
|
bool RTLIL::Design::selected_whole_module(RTLIL::IdString mod_name) const
|
||||||
{
|
{
|
||||||
if (!selected_active_module.empty() && mod_name != selected_active_module)
|
if (!selected_active_module.empty() && mod_name != selected_active_module)
|
||||||
return false;
|
return false;
|
||||||
return selection().selected_whole_module(mod_name);
|
return selection().selected_whole_module(mod_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Design::selected_member(const RTLIL::IdString& mod_name, const RTLIL::IdString& memb_name) const
|
bool RTLIL::Design::selected_member(RTLIL::IdString mod_name, RTLIL::IdString memb_name) const
|
||||||
{
|
{
|
||||||
if (!selected_active_module.empty() && mod_name != selected_active_module)
|
if (!selected_active_module.empty() && mod_name != selected_active_module)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1693,7 +1693,7 @@ RTLIL::IdString RTLIL::Module::derive(RTLIL::Design*, const dict<RTLIL::IdString
|
||||||
log_error("Module `%s' is used with parameters but is not parametric!\n", id2cstr(name));
|
log_error("Module `%s' is used with parameters but is not parametric!\n", id2cstr(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RTLIL::Module::count_id(const RTLIL::IdString& id)
|
size_t RTLIL::Module::count_id(RTLIL::IdString id)
|
||||||
{
|
{
|
||||||
return wires_.count(id) + memories.count(id) + cells_.count(id) + processes.count(id);
|
return wires_.count(id) + memories.count(id) + cells_.count(id) + processes.count(id);
|
||||||
}
|
}
|
||||||
|
|
@ -1718,7 +1718,7 @@ namespace {
|
||||||
cell->name.c_str(), cell->type.c_str(), __FILE__, linenr, buf.str().c_str());
|
cell->name.c_str(), cell->type.c_str(), __FILE__, linenr, buf.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int param(const RTLIL::IdString& name)
|
int param(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
auto it = cell->parameters.find(name);
|
auto it = cell->parameters.find(name);
|
||||||
if (it == cell->parameters.end())
|
if (it == cell->parameters.end())
|
||||||
|
|
@ -1727,7 +1727,7 @@ namespace {
|
||||||
return it->second.as_int();
|
return it->second.as_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
int param_bool(const RTLIL::IdString& name)
|
int param_bool(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
int v = param(name);
|
int v = param(name);
|
||||||
if (GetSize(cell->parameters.at(name)) > 32)
|
if (GetSize(cell->parameters.at(name)) > 32)
|
||||||
|
|
@ -1737,7 +1737,7 @@ namespace {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int param_bool(const RTLIL::IdString& name, bool expected)
|
int param_bool(RTLIL::IdString name, bool expected)
|
||||||
{
|
{
|
||||||
int v = param_bool(name);
|
int v = param_bool(name);
|
||||||
if (v != expected)
|
if (v != expected)
|
||||||
|
|
@ -1745,20 +1745,20 @@ namespace {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void param_bits(const RTLIL::IdString& name, int width)
|
void param_bits(RTLIL::IdString name, int width)
|
||||||
{
|
{
|
||||||
param(name);
|
param(name);
|
||||||
if (GetSize(cell->parameters.at(name)) != width)
|
if (GetSize(cell->parameters.at(name)) != width)
|
||||||
error(__LINE__);
|
error(__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string param_string(const RTLIL::IdString &name)
|
std::string param_string(RTLIL::IdString name)
|
||||||
{
|
{
|
||||||
param(name);
|
param(name);
|
||||||
return cell->parameters.at(name).decode_string();
|
return cell->parameters.at(name).decode_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void port(const RTLIL::IdString& name, int width)
|
void port(RTLIL::IdString name, int width)
|
||||||
{
|
{
|
||||||
auto it = cell->connections_.find(name);
|
auto it = cell->connections_.find(name);
|
||||||
if (it == cell->connections_.end())
|
if (it == cell->connections_.end())
|
||||||
|
|
@ -4366,14 +4366,14 @@ std::map<unsigned int, RTLIL::Cell*> *RTLIL::Cell::get_all_cells(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool RTLIL::Cell::hasPort(const RTLIL::IdString& portname) const
|
bool RTLIL::Cell::hasPort(RTLIL::IdString portname) const
|
||||||
{
|
{
|
||||||
return connections_.count(portname) != 0;
|
return connections_.count(portname) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bufnorm
|
// bufnorm
|
||||||
|
|
||||||
const RTLIL::SigSpec &RTLIL::Cell::getPort(const RTLIL::IdString& portname) const
|
const RTLIL::SigSpec &RTLIL::Cell::getPort(RTLIL::IdString portname) const
|
||||||
{
|
{
|
||||||
return connections_.at(portname);
|
return connections_.at(portname);
|
||||||
}
|
}
|
||||||
|
|
@ -4392,7 +4392,7 @@ bool RTLIL::Cell::known() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Cell::input(const RTLIL::IdString& portname) const
|
bool RTLIL::Cell::input(RTLIL::IdString portname) const
|
||||||
{
|
{
|
||||||
if (yosys_celltypes.cell_known(type))
|
if (yosys_celltypes.cell_known(type))
|
||||||
return yosys_celltypes.cell_input(type, portname);
|
return yosys_celltypes.cell_input(type, portname);
|
||||||
|
|
@ -4404,7 +4404,7 @@ bool RTLIL::Cell::input(const RTLIL::IdString& portname) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Cell::output(const RTLIL::IdString& portname) const
|
bool RTLIL::Cell::output(RTLIL::IdString portname) const
|
||||||
{
|
{
|
||||||
if (yosys_celltypes.cell_known(type))
|
if (yosys_celltypes.cell_known(type))
|
||||||
return yosys_celltypes.cell_output(type, portname);
|
return yosys_celltypes.cell_output(type, portname);
|
||||||
|
|
@ -4416,7 +4416,7 @@ bool RTLIL::Cell::output(const RTLIL::IdString& portname) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLIL::PortDir RTLIL::Cell::port_dir(const RTLIL::IdString& portname) const
|
RTLIL::PortDir RTLIL::Cell::port_dir(RTLIL::IdString portname) const
|
||||||
{
|
{
|
||||||
if (yosys_celltypes.cell_known(type))
|
if (yosys_celltypes.cell_known(type))
|
||||||
return yosys_celltypes.cell_port_dir(type, portname);
|
return yosys_celltypes.cell_port_dir(type, portname);
|
||||||
|
|
@ -4432,22 +4432,22 @@ RTLIL::PortDir RTLIL::Cell::port_dir(const RTLIL::IdString& portname) const
|
||||||
return PortDir::PD_UNKNOWN;
|
return PortDir::PD_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTLIL::Cell::hasParam(const RTLIL::IdString& paramname) const
|
bool RTLIL::Cell::hasParam(RTLIL::IdString paramname) const
|
||||||
{
|
{
|
||||||
return parameters.count(paramname) != 0;
|
return parameters.count(paramname) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Cell::unsetParam(const RTLIL::IdString& paramname)
|
void RTLIL::Cell::unsetParam(RTLIL::IdString paramname)
|
||||||
{
|
{
|
||||||
parameters.erase(paramname);
|
parameters.erase(paramname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Cell::setParam(const RTLIL::IdString& paramname, RTLIL::Const value)
|
void RTLIL::Cell::setParam(RTLIL::IdString paramname, RTLIL::Const value)
|
||||||
{
|
{
|
||||||
parameters[paramname] = std::move(value);
|
parameters[paramname] = std::move(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RTLIL::Const &RTLIL::Cell::getParam(const RTLIL::IdString& paramname) const
|
const RTLIL::Const &RTLIL::Cell::getParam(RTLIL::IdString paramname) const
|
||||||
{
|
{
|
||||||
const auto &it = parameters.find(paramname);
|
const auto &it = parameters.find(paramname);
|
||||||
if (it != parameters.end())
|
if (it != parameters.end())
|
||||||
|
|
|
||||||
|
|
@ -241,8 +241,6 @@ struct RTLIL::IdString
|
||||||
*this = id;
|
*this = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline const IdString &id_string() const { return *this; }
|
|
||||||
|
|
||||||
inline const char *c_str() const {
|
inline const char *c_str() const {
|
||||||
if (index_ >= 0)
|
if (index_ >= 0)
|
||||||
return global_id_storage_.at(index_).buf;
|
return global_id_storage_.at(index_).buf;
|
||||||
|
|
@ -372,7 +370,7 @@ struct RTLIL::IdString
|
||||||
return Substrings(global_autoidx_id_storage_.at(index_).prefix, -index_);
|
return Substrings(global_autoidx_id_storage_.at(index_).prefix, -index_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool lt_by_name(const IdString &rhs) const {
|
inline bool lt_by_name(IdString rhs) const {
|
||||||
Substrings lhs_it = substrings();
|
Substrings lhs_it = substrings();
|
||||||
Substrings rhs_it = rhs.substrings();
|
Substrings rhs_it = rhs.substrings();
|
||||||
std::string_view lhs_substr = lhs_it.first();
|
std::string_view lhs_substr = lhs_it.first();
|
||||||
|
|
@ -399,12 +397,12 @@ struct RTLIL::IdString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator<(const IdString &rhs) const {
|
inline bool operator<(IdString rhs) const {
|
||||||
return index_ < rhs.index_;
|
return index_ < rhs.index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(const IdString &rhs) const { return index_ == rhs.index_; }
|
inline bool operator==(IdString rhs) const { return index_ == rhs.index_; }
|
||||||
inline bool operator!=(const IdString &rhs) const { return index_ != rhs.index_; }
|
inline bool operator!=(IdString rhs) const { return index_ != rhs.index_; }
|
||||||
|
|
||||||
// The methods below are just convenience functions for better compatibility with std::string.
|
// The methods below are just convenience functions for better compatibility with std::string.
|
||||||
|
|
||||||
|
|
@ -528,7 +526,7 @@ struct RTLIL::IdString
|
||||||
return (... || in(args));
|
return (... || in(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool in(const IdString &rhs) const { return *this == rhs; }
|
bool in(IdString rhs) const { return *this == rhs; }
|
||||||
bool in(const char *rhs) const { return *this == rhs; }
|
bool in(const char *rhs) const { return *this == rhs; }
|
||||||
bool in(const std::string &rhs) const { return *this == rhs; }
|
bool in(const std::string &rhs) const { return *this == rhs; }
|
||||||
inline bool in(const pool<IdString> &rhs) const;
|
inline bool in(const pool<IdString> &rhs) const;
|
||||||
|
|
@ -646,13 +644,13 @@ private:
|
||||||
namespace hashlib {
|
namespace hashlib {
|
||||||
template <>
|
template <>
|
||||||
struct hash_ops<RTLIL::IdString> {
|
struct hash_ops<RTLIL::IdString> {
|
||||||
static inline bool cmp(const RTLIL::IdString &a, const RTLIL::IdString &b) {
|
static inline bool cmp(RTLIL::IdString a, RTLIL::IdString b) {
|
||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
[[nodiscard]] static inline Hasher hash(const RTLIL::IdString &id) {
|
[[nodiscard]] static inline Hasher hash(RTLIL::IdString id) {
|
||||||
return id.hash_top();
|
return id.hash_top();
|
||||||
}
|
}
|
||||||
[[nodiscard]] static inline Hasher hash_into(const RTLIL::IdString &id, Hasher h) {
|
[[nodiscard]] static inline Hasher hash_into(RTLIL::IdString id, Hasher h) {
|
||||||
return id.hash_into(h);
|
return id.hash_into(h);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -759,11 +757,11 @@ namespace RTLIL {
|
||||||
return str.substr(1);
|
return str.substr(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline std::string unescape_id(const RTLIL::IdString &str) {
|
static inline std::string unescape_id(RTLIL::IdString str) {
|
||||||
return unescape_id(str.str());
|
return unescape_id(str.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char *id2cstr(const RTLIL::IdString &str) {
|
static inline const char *id2cstr(RTLIL::IdString str) {
|
||||||
return log_id(str);
|
return log_id(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -780,7 +778,7 @@ namespace RTLIL {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sort_by_id_str {
|
struct sort_by_id_str {
|
||||||
bool operator()(const RTLIL::IdString &a, const RTLIL::IdString &b) const {
|
bool operator()(RTLIL::IdString a, RTLIL::IdString b) const {
|
||||||
return a.lt_by_name(b);
|
return a.lt_by_name(b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1246,22 +1244,22 @@ struct RTLIL::AttrObject
|
||||||
{
|
{
|
||||||
dict<RTLIL::IdString, RTLIL::Const> attributes;
|
dict<RTLIL::IdString, RTLIL::Const> attributes;
|
||||||
|
|
||||||
bool has_attribute(const RTLIL::IdString &id) const;
|
bool has_attribute(RTLIL::IdString id) const;
|
||||||
|
|
||||||
void set_bool_attribute(const RTLIL::IdString &id, bool value=true);
|
void set_bool_attribute(RTLIL::IdString id, bool value=true);
|
||||||
bool get_bool_attribute(const RTLIL::IdString &id) const;
|
bool get_bool_attribute(RTLIL::IdString id) const;
|
||||||
|
|
||||||
[[deprecated("Use Module::get_blackbox_attribute() instead.")]]
|
[[deprecated("Use Module::get_blackbox_attribute() instead.")]]
|
||||||
bool get_blackbox_attribute(bool ignore_wb=false) const {
|
bool get_blackbox_attribute(bool ignore_wb=false) const {
|
||||||
return get_bool_attribute(ID::blackbox) || (!ignore_wb && get_bool_attribute(ID::whitebox));
|
return get_bool_attribute(ID::blackbox) || (!ignore_wb && get_bool_attribute(ID::whitebox));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_string_attribute(const RTLIL::IdString& id, string value);
|
void set_string_attribute(RTLIL::IdString id, string value);
|
||||||
string get_string_attribute(const RTLIL::IdString &id) const;
|
string get_string_attribute(RTLIL::IdString id) const;
|
||||||
|
|
||||||
void set_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data);
|
void set_strpool_attribute(RTLIL::IdString id, const pool<string> &data);
|
||||||
void add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data);
|
void add_strpool_attribute(RTLIL::IdString id, const pool<string> &data);
|
||||||
pool<string> get_strpool_attribute(const RTLIL::IdString &id) const;
|
pool<string> get_strpool_attribute(RTLIL::IdString id) const;
|
||||||
|
|
||||||
void set_src_attribute(const std::string &src) {
|
void set_src_attribute(const std::string &src) {
|
||||||
set_string_attribute(ID::src, src);
|
set_string_attribute(ID::src, src);
|
||||||
|
|
@ -1273,8 +1271,8 @@ struct RTLIL::AttrObject
|
||||||
void set_hdlname_attribute(const vector<string> &hierarchy);
|
void set_hdlname_attribute(const vector<string> &hierarchy);
|
||||||
vector<string> get_hdlname_attribute() const;
|
vector<string> get_hdlname_attribute() const;
|
||||||
|
|
||||||
void set_intvec_attribute(const RTLIL::IdString& id, const vector<int> &data);
|
void set_intvec_attribute(RTLIL::IdString id, const vector<int> &data);
|
||||||
vector<int> get_intvec_attribute(const RTLIL::IdString &id) const;
|
vector<int> get_intvec_attribute(RTLIL::IdString id) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RTLIL::NamedObject : public RTLIL::AttrObject
|
struct RTLIL::NamedObject : public RTLIL::AttrObject
|
||||||
|
|
@ -1781,18 +1779,18 @@ struct RTLIL::Selection
|
||||||
|
|
||||||
// checks if the given module exists in the current design and is a
|
// checks if the given module exists in the current design and is a
|
||||||
// boxed module, warning the user if the current design is not set
|
// boxed module, warning the user if the current design is not set
|
||||||
bool boxed_module(const RTLIL::IdString &mod_name) const;
|
bool boxed_module(RTLIL::IdString mod_name) const;
|
||||||
|
|
||||||
// checks if the given module is included in this selection
|
// checks if the given module is included in this selection
|
||||||
bool selected_module(const RTLIL::IdString &mod_name) const;
|
bool selected_module(RTLIL::IdString mod_name) const;
|
||||||
|
|
||||||
// checks if the given module is wholly included in this selection,
|
// checks if the given module is wholly included in this selection,
|
||||||
// i.e. not partially selected
|
// i.e. not partially selected
|
||||||
bool selected_whole_module(const RTLIL::IdString &mod_name) const;
|
bool selected_whole_module(RTLIL::IdString mod_name) const;
|
||||||
|
|
||||||
// checks if the given member from the given module is included in this
|
// checks if the given member from the given module is included in this
|
||||||
// selection
|
// selection
|
||||||
bool selected_member(const RTLIL::IdString &mod_name, const RTLIL::IdString &memb_name) const;
|
bool selected_member(RTLIL::IdString mod_name, RTLIL::IdString memb_name) const;
|
||||||
|
|
||||||
// optimizes this selection for the given design by:
|
// optimizes this selection for the given design by:
|
||||||
// - removing non-existent modules and members, any boxed modules and
|
// - removing non-existent modules and members, any boxed modules and
|
||||||
|
|
@ -1862,7 +1860,7 @@ struct RTLIL::Monitor
|
||||||
virtual ~Monitor() { }
|
virtual ~Monitor() { }
|
||||||
virtual void notify_module_add(RTLIL::Module*) { }
|
virtual void notify_module_add(RTLIL::Module*) { }
|
||||||
virtual void notify_module_del(RTLIL::Module*) { }
|
virtual void notify_module_del(RTLIL::Module*) { }
|
||||||
virtual void notify_connect(RTLIL::Cell*, const RTLIL::IdString&, const RTLIL::SigSpec&, const RTLIL::SigSpec&) { }
|
virtual void notify_connect(RTLIL::Cell*, RTLIL::IdString, const RTLIL::SigSpec&, const RTLIL::SigSpec&) { }
|
||||||
virtual void notify_connect(RTLIL::Module*, const RTLIL::SigSig&) { }
|
virtual void notify_connect(RTLIL::Module*, const RTLIL::SigSig&) { }
|
||||||
virtual void notify_connect(RTLIL::Module*, const std::vector<RTLIL::SigSig>&) { }
|
virtual void notify_connect(RTLIL::Module*, const std::vector<RTLIL::SigSig>&) { }
|
||||||
virtual void notify_blackout(RTLIL::Module*) { }
|
virtual void notify_blackout(RTLIL::Module*) { }
|
||||||
|
|
@ -1897,11 +1895,11 @@ struct RTLIL::Design
|
||||||
~Design();
|
~Design();
|
||||||
|
|
||||||
RTLIL::ObjRange<RTLIL::Module*> modules();
|
RTLIL::ObjRange<RTLIL::Module*> modules();
|
||||||
RTLIL::Module *module(const RTLIL::IdString &name);
|
RTLIL::Module *module(RTLIL::IdString name);
|
||||||
const RTLIL::Module *module(const RTLIL::IdString &name) const;
|
const RTLIL::Module *module(RTLIL::IdString name) const;
|
||||||
RTLIL::Module *top_module() const;
|
RTLIL::Module *top_module() const;
|
||||||
|
|
||||||
bool has(const RTLIL::IdString &id) const {
|
bool has(RTLIL::IdString id) const {
|
||||||
return modules_.count(id) != 0;
|
return modules_.count(id) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1928,15 +1926,15 @@ struct RTLIL::Design
|
||||||
void optimize();
|
void optimize();
|
||||||
|
|
||||||
// checks if the given module is included in the current selection
|
// checks if the given module is included in the current selection
|
||||||
bool selected_module(const RTLIL::IdString &mod_name) const;
|
bool selected_module(RTLIL::IdString mod_name) const;
|
||||||
|
|
||||||
// checks if the given module is wholly included in the current
|
// checks if the given module is wholly included in the current
|
||||||
// selection, i.e. not partially selected
|
// selection, i.e. not partially selected
|
||||||
bool selected_whole_module(const RTLIL::IdString &mod_name) const;
|
bool selected_whole_module(RTLIL::IdString mod_name) const;
|
||||||
|
|
||||||
// checks if the given member from the given module is included in the
|
// checks if the given member from the given module is included in the
|
||||||
// current selection
|
// current selection
|
||||||
bool selected_member(const RTLIL::IdString &mod_name, const RTLIL::IdString &memb_name) const;
|
bool selected_member(RTLIL::IdString mod_name, RTLIL::IdString memb_name) const;
|
||||||
|
|
||||||
// checks if the given module is included in the current selection
|
// checks if the given module is included in the current selection
|
||||||
bool selected_module(RTLIL::Module *mod) const;
|
bool selected_module(RTLIL::Module *mod) const;
|
||||||
|
|
@ -2068,7 +2066,7 @@ public:
|
||||||
virtual ~Module();
|
virtual ~Module();
|
||||||
virtual RTLIL::IdString derive(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Const> ¶meters, bool mayfail = false);
|
virtual RTLIL::IdString derive(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Const> ¶meters, bool mayfail = false);
|
||||||
virtual RTLIL::IdString derive(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Const> ¶meters, const dict<RTLIL::IdString, RTLIL::Module*> &interfaces, const dict<RTLIL::IdString, RTLIL::IdString> &modports, bool mayfail = false);
|
virtual RTLIL::IdString derive(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Const> ¶meters, const dict<RTLIL::IdString, RTLIL::Module*> &interfaces, const dict<RTLIL::IdString, RTLIL::IdString> &modports, bool mayfail = false);
|
||||||
virtual size_t count_id(const RTLIL::IdString& id);
|
virtual size_t count_id(RTLIL::IdString id);
|
||||||
virtual void expand_interfaces(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Module *> &local_interfaces);
|
virtual void expand_interfaces(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Module *> &local_interfaces);
|
||||||
virtual bool reprocess_if_necessary(RTLIL::Design *design);
|
virtual bool reprocess_if_necessary(RTLIL::Design *design);
|
||||||
|
|
||||||
|
|
@ -2120,20 +2118,20 @@ public:
|
||||||
return design->selected_member(name, member->name);
|
return design->selected_member(name, member->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLIL::Wire* wire(const RTLIL::IdString &id) {
|
RTLIL::Wire* wire(RTLIL::IdString id) {
|
||||||
auto it = wires_.find(id);
|
auto it = wires_.find(id);
|
||||||
return it == wires_.end() ? nullptr : it->second;
|
return it == wires_.end() ? nullptr : it->second;
|
||||||
}
|
}
|
||||||
RTLIL::Cell* cell(const RTLIL::IdString &id) {
|
RTLIL::Cell* cell(RTLIL::IdString id) {
|
||||||
auto it = cells_.find(id);
|
auto it = cells_.find(id);
|
||||||
return it == cells_.end() ? nullptr : it->second;
|
return it == cells_.end() ? nullptr : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const RTLIL::Wire* wire(const RTLIL::IdString &id) const{
|
const RTLIL::Wire* wire(RTLIL::IdString id) const{
|
||||||
auto it = wires_.find(id);
|
auto it = wires_.find(id);
|
||||||
return it == wires_.end() ? nullptr : it->second;
|
return it == wires_.end() ? nullptr : it->second;
|
||||||
}
|
}
|
||||||
const RTLIL::Cell* cell(const RTLIL::IdString &id) const {
|
const RTLIL::Cell* cell(RTLIL::IdString id) const {
|
||||||
auto it = cells_.find(id);
|
auto it = cells_.find(id);
|
||||||
return it == cells_.end() ? nullptr : it->second;
|
return it == cells_.end() ? nullptr : it->second;
|
||||||
}
|
}
|
||||||
|
|
@ -2490,23 +2488,23 @@ public:
|
||||||
dict<RTLIL::IdString, RTLIL::Const> parameters;
|
dict<RTLIL::IdString, RTLIL::Const> parameters;
|
||||||
|
|
||||||
// access cell ports
|
// access cell ports
|
||||||
bool hasPort(const RTLIL::IdString &portname) const;
|
bool hasPort(RTLIL::IdString portname) const;
|
||||||
void unsetPort(const RTLIL::IdString &portname);
|
void unsetPort(RTLIL::IdString portname);
|
||||||
void setPort(const RTLIL::IdString &portname, RTLIL::SigSpec signal);
|
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal);
|
||||||
const RTLIL::SigSpec &getPort(const RTLIL::IdString &portname) const;
|
const RTLIL::SigSpec &getPort(RTLIL::IdString portname) const;
|
||||||
const dict<RTLIL::IdString, RTLIL::SigSpec> &connections() const;
|
const dict<RTLIL::IdString, RTLIL::SigSpec> &connections() const;
|
||||||
|
|
||||||
// information about cell ports
|
// information about cell ports
|
||||||
bool known() const;
|
bool known() const;
|
||||||
bool input(const RTLIL::IdString &portname) const;
|
bool input(RTLIL::IdString portname) const;
|
||||||
bool output(const RTLIL::IdString &portname) const;
|
bool output(RTLIL::IdString portname) const;
|
||||||
PortDir port_dir(const RTLIL::IdString &portname) const;
|
PortDir port_dir(RTLIL::IdString portname) const;
|
||||||
|
|
||||||
// access cell parameters
|
// access cell parameters
|
||||||
bool hasParam(const RTLIL::IdString ¶mname) const;
|
bool hasParam(RTLIL::IdString paramname) const;
|
||||||
void unsetParam(const RTLIL::IdString ¶mname);
|
void unsetParam(RTLIL::IdString paramname);
|
||||||
void setParam(const RTLIL::IdString ¶mname, RTLIL::Const value);
|
void setParam(RTLIL::IdString paramname, RTLIL::Const value);
|
||||||
const RTLIL::Const &getParam(const RTLIL::IdString ¶mname) const;
|
const RTLIL::Const &getParam(RTLIL::IdString paramname) const;
|
||||||
|
|
||||||
void sort();
|
void sort();
|
||||||
void check();
|
void check();
|
||||||
|
|
|
||||||
|
|
@ -526,7 +526,7 @@ void RTLIL::Module::bufNormalize()
|
||||||
pending_deleted_cells.clear();
|
pending_deleted_cells.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Cell::unsetPort(const RTLIL::IdString& portname)
|
void RTLIL::Cell::unsetPort(RTLIL::IdString portname)
|
||||||
{
|
{
|
||||||
RTLIL::SigSpec signal;
|
RTLIL::SigSpec signal;
|
||||||
auto conn_it = connections_.find(portname);
|
auto conn_it = connections_.find(portname);
|
||||||
|
|
@ -586,7 +586,7 @@ void RTLIL::Cell::unsetPort(const RTLIL::IdString& portname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Cell::setPort(const RTLIL::IdString& portname, RTLIL::SigSpec signal)
|
void RTLIL::Cell::setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
|
||||||
{
|
{
|
||||||
auto r = connections_.insert(portname);
|
auto r = connections_.insert(portname);
|
||||||
auto conn_it = r.first;
|
auto conn_it = r.first;
|
||||||
|
|
|
||||||
|
|
@ -97,13 +97,13 @@ static const char *attr_prefix(ScopeinfoAttrs attrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool scopeinfo_has_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, const RTLIL::IdString &id)
|
bool scopeinfo_has_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, RTLIL::IdString id)
|
||||||
{
|
{
|
||||||
log_assert(scopeinfo->type == ID($scopeinfo));
|
log_assert(scopeinfo->type == ID($scopeinfo));
|
||||||
return scopeinfo->has_attribute(attr_prefix(attrs) + RTLIL::unescape_id(id));
|
return scopeinfo->has_attribute(attr_prefix(attrs) + RTLIL::unescape_id(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLIL::Const scopeinfo_get_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, const RTLIL::IdString &id)
|
RTLIL::Const scopeinfo_get_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, RTLIL::IdString id)
|
||||||
{
|
{
|
||||||
log_assert(scopeinfo->type == ID($scopeinfo));
|
log_assert(scopeinfo->type == ID($scopeinfo));
|
||||||
auto found = scopeinfo->attributes.find(attr_prefix(attrs) + RTLIL::unescape_id(id));
|
auto found = scopeinfo->attributes.find(attr_prefix(attrs) + RTLIL::unescape_id(id));
|
||||||
|
|
|
||||||
|
|
@ -433,10 +433,10 @@ enum class ScopeinfoAttrs {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check whether the flattened module or flattened cell corresponding to a $scopeinfo cell had a specific attribute.
|
// Check whether the flattened module or flattened cell corresponding to a $scopeinfo cell had a specific attribute.
|
||||||
bool scopeinfo_has_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, const RTLIL::IdString &id);
|
bool scopeinfo_has_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, RTLIL::IdString id);
|
||||||
|
|
||||||
// Get a specific attribute from the flattened module or flattened cell corresponding to a $scopeinfo cell.
|
// Get a specific attribute from the flattened module or flattened cell corresponding to a $scopeinfo cell.
|
||||||
RTLIL::Const scopeinfo_get_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, const RTLIL::IdString &id);
|
RTLIL::Const scopeinfo_get_attribute(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs, RTLIL::IdString id);
|
||||||
|
|
||||||
// Get all attribute from the flattened module or flattened cell corresponding to a $scopeinfo cell.
|
// Get all attribute from the flattened module or flattened cell corresponding to a $scopeinfo cell.
|
||||||
dict<RTLIL::IdString, RTLIL::Const> scopeinfo_attributes(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs);
|
dict<RTLIL::IdString, RTLIL::Const> scopeinfo_attributes(const RTLIL::Cell *scopeinfo, ScopeinfoAttrs attrs);
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ struct ExampleDtPass : public Pass
|
||||||
auto enqueue = [&](DriveSpec const &spec) {
|
auto enqueue = [&](DriveSpec const &spec) {
|
||||||
int index = queue(spec);
|
int index = queue(spec);
|
||||||
if (index == GetSize(graph_nodes))
|
if (index == GetSize(graph_nodes))
|
||||||
graph_nodes.emplace_back(compute_graph.add(ID($pending).id_string(), index).index());
|
graph_nodes.emplace_back(compute_graph.add(ID($pending), index).index());
|
||||||
//if (index >= GetSize(graph_nodes))
|
//if (index >= GetSize(graph_nodes))
|
||||||
return compute_graph[graph_nodes[index]];
|
return compute_graph[graph_nodes[index]];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ struct PrintAttrsPass : public Pass {
|
||||||
return stringf("%*s", indent, "");
|
return stringf("%*s", indent, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_const(const RTLIL::IdString &s, const RTLIL::Const &x, const unsigned int indent) {
|
static void log_const(RTLIL::IdString s, const RTLIL::Const &x, const unsigned int indent) {
|
||||||
if (x.flags & RTLIL::CONST_FLAG_STRING)
|
if (x.flags & RTLIL::CONST_FLAG_STRING)
|
||||||
log("%s(* %s=\"%s\" *)\n", get_indent_str(indent), log_id(s), x.decode_string());
|
log("%s(* %s=\"%s\" *)\n", get_indent_str(indent), log_id(s), x.decode_string());
|
||||||
else if (x.flags == RTLIL::CONST_FLAG_NONE || x.flags == RTLIL::CONST_FLAG_SIGNED)
|
else if (x.flags == RTLIL::CONST_FLAG_NONE || x.flags == RTLIL::CONST_FLAG_SIGNED)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ struct TraceMonitor : public RTLIL::Monitor
|
||||||
log("#TRACE# Module delete: %s\n", log_id(module));
|
log("#TRACE# Module delete: %s\n", log_id(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_connect(RTLIL::Cell *cell, const RTLIL::IdString &port, const RTLIL::SigSpec &old_sig, const RTLIL::SigSpec &sig) override
|
void notify_connect(RTLIL::Cell *cell, RTLIL::IdString port, const RTLIL::SigSpec &old_sig, const RTLIL::SigSpec &sig) override
|
||||||
{
|
{
|
||||||
log("#TRACE# Cell connect: %s.%s.%s = %s (was: %s)\n", log_id(cell->module), log_id(cell), log_id(port), log_signal(sig), log_signal(old_sig));
|
log("#TRACE# Cell connect: %s.%s.%s = %s (was: %s)\n", log_id(cell->module), log_id(cell), log_id(port), log_signal(sig), log_signal(old_sig));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,7 @@ struct BufnormPass : public Pass {
|
||||||
return mapped_bits.at(bit);
|
return mapped_bits.at(bit);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto make_buffer_f = [&](const IdString &type, const SigSpec &src, const SigSpec &dst)
|
auto make_buffer_f = [&](IdString type, const SigSpec &src, const SigSpec &dst)
|
||||||
{
|
{
|
||||||
auto it = old_buffers.find(pair<IdString, SigSpec>(type, dst));
|
auto it = old_buffers.find(pair<IdString, SigSpec>(type, dst));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
USING_YOSYS_NAMESPACE
|
USING_YOSYS_NAMESPACE
|
||||||
YOSYS_NAMESPACE_BEGIN
|
YOSYS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
static void transfer_attr (Cell* to, const Cell* from, const IdString& attr) {
|
static void transfer_attr (Cell* to, const Cell* from, IdString attr) {
|
||||||
if (from->has_attribute(attr))
|
if (from->has_attribute(attr))
|
||||||
to->attributes[attr] = from->attributes.at(attr);
|
to->attributes[attr] = from->attributes.at(attr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ namespace pyosys {
|
||||||
|
|
||||||
void notify_connect(
|
void notify_connect(
|
||||||
RTLIL::Cell *cell,
|
RTLIL::Cell *cell,
|
||||||
const RTLIL::IdString &port,
|
RTLIL::IdString port,
|
||||||
const RTLIL::SigSpec &old_sig,
|
const RTLIL::SigSpec &old_sig,
|
||||||
const RTLIL::SigSpec &sig
|
const RTLIL::SigSpec &sig
|
||||||
) override {
|
) override {
|
||||||
|
|
@ -228,7 +228,7 @@ namespace pyosys {
|
||||||
"notify_connect",
|
"notify_connect",
|
||||||
py::overload_cast<
|
py::overload_cast<
|
||||||
RTLIL::Cell *,
|
RTLIL::Cell *,
|
||||||
const RTLIL::IdString &,
|
RTLIL::IdString,
|
||||||
const RTLIL::SigSpec &,
|
const RTLIL::SigSpec &,
|
||||||
const RTLIL::SigSpec &
|
const RTLIL::SigSpec &
|
||||||
>(&RTLIL::Monitor::notify_connect)
|
>(&RTLIL::Monitor::notify_connect)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue