Fixed handling of boolean attributes (passes)

This commit is contained in:
Clifford Wolf 2013-10-24 11:37:54 +02:00
parent e9dede01ca
commit e679a5d046
6 changed files with 8 additions and 8 deletions

View File

@ -368,7 +368,7 @@ struct RTLIL::CaseRule {
struct RTLIL::SwitchRule {
RTLIL::SigSpec signal;
std::map<RTLIL::IdString, RTLIL::Const> attributes;
RTLIL_ATTRIBUTE_MEMBERS
std::vector<RTLIL::CaseRule*> cases;
~SwitchRule();
void optimize();

View File

@ -477,7 +477,7 @@ struct ShowWorker
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
@ -617,7 +617,7 @@ struct ShowPass : public Pass {
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;

View File

@ -113,7 +113,7 @@ static void generate(RTLIL::Design *design, const std::vector<std::string> &cell
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) {
@ -147,7 +147,7 @@ static bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool fla
}
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);

View File

@ -47,7 +47,7 @@ static void rmunused_module_cells(RTLIL::Module *module, bool verbose)
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);
}

View File

@ -210,7 +210,7 @@ static RTLIL::SigSpec signal_to_mux_tree(RTLIL::Module *mod, RTLIL::CaseRule *cs
{
// 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++) {

View File

@ -144,7 +144,7 @@ struct IopadmapPass : public Pass {
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;