struct RTLIL::SwitchRule {
RTLIL::SigSpec signal;
- std::map<RTLIL::IdString, RTLIL::Const> attributes;
+ RTLIL_ATTRIBUTE_MEMBERS
std::vector<RTLIL::CaseRule*> cases;
~SwitchRule();
void optimize();
if (!design->selected_module(module->name))
continue;
if (design->selected_whole_module(module->name)) {
- if (module->attributes.count("\\placeholder") > 0) {
+ if (module->get_bool_attribute("\\placeholder") > 0) {
log("Skipping placeholder module %s.\n", id2cstr(module->name));
continue;
} else
if (format != "ps") {
int modcount = 0;
for (auto &mod_it : design->modules) {
- if (mod_it.second->attributes.count("\\placeholder") > 0)
+ if (mod_it.second->get_bool_attribute("\\placeholder") > 0)
continue;
if (mod_it.second->cells.empty() && mod_it.second->connections.empty())
continue;
RTLIL::Module *mod = new RTLIL::Module;
mod->name = celltype;
- mod->attributes["\\placeholder"] = RTLIL::Const(0, 0);
+ mod->attributes["\\placeholder"] = RTLIL::Const(1);
design->modules[mod->name] = mod;
for (auto &decl : ports) {
}
if (cell->parameters.size() == 0)
continue;
- if (design->modules.at(cell->type)->attributes.count("\\placeholder") > 0)
+ if (design->modules.at(cell->type)->get_bool_attribute("\\placeholder"))
continue;
RTLIL::Module *mod = design->modules[cell->type];
cell->type = mod->derive(design, cell->parameters);
wire2driver.insert(sig, cell);
}
}
- if (cell->type == "$memwr" || cell->attributes.count("\\keep"))
+ if (cell->type == "$memwr" || cell->get_bool_attribute("\\keep"))
queue.insert(cell);
unused.insert(cell);
}
{
// detect groups of parallel cases
std::vector<int> pgroups(sw->cases.size());
- if (sw->attributes.count("\\parallel_case") == 0) {
+ if (!sw->get_bool_attribute("\\parallel_case")) {
BitPatternPool pool(sw->signal.width);
bool extra_group_for_next_case = false;
for (size_t i = 0; i < sw->cases.size(); i++) {
cell->parameters[RTLIL::escape_id(widthparam)] = RTLIL::Const(wire->width);
if (!nameparam.empty())
cell->parameters[RTLIL::escape_id(nameparam)] = RTLIL::Const(RTLIL::id2cstr(wire->name));
- cell->attributes["\\keep"] = RTLIL::Const();
+ cell->attributes["\\keep"] = RTLIL::Const(1);
module->add(cell);
wire->port_id = 0;