3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-13 04:28:18 +00:00

Fix tabs and cleanup

This commit is contained in:
Eddie Hung 2020-01-07 09:32:58 -08:00
parent b57f692a9e
commit 6e12ba218b

View file

@ -521,49 +521,49 @@ void reintegrate(RTLIL::Module *module)
RTLIL::Module* box_module = design->module(mapped_cell->type); RTLIL::Module* box_module = design->module(mapped_cell->type);
auto abc9_flop = box_module && box_module->attributes.count("\\abc9_flop"); auto abc9_flop = box_module && box_module->attributes.count("\\abc9_flop");
for (auto &mapped_conn : mapped_cell->connections()) { for (auto &mapped_conn : mapped_cell->connections()) {
RTLIL::SigSpec newsig; RTLIL::SigSpec newsig;
for (auto c : mapped_conn.second.chunks()) { for (auto c : mapped_conn.second.chunks()) {
if (c.width == 0) if (c.width == 0)
continue; continue;
//log_assert(c.width == 1); //log_assert(c.width == 1);
if (c.wire) if (c.wire)
c.wire = module->wires_.at(remap_name(c.wire->name)); c.wire = module->wires_.at(remap_name(c.wire->name));
newsig.append(c); newsig.append(c);
} }
if (existing_cell) { if (existing_cell) {
auto it = existing_cell->connections_.find(mapped_conn.first); auto it = existing_cell->connections_.find(mapped_conn.first);
if (it == existing_cell->connections_.end()) if (it == existing_cell->connections_.end())
continue; continue;
log_assert(GetSize(newsig) >= GetSize(it->second)); log_assert(GetSize(newsig) >= GetSize(it->second));
newsig = newsig.extract(0, GetSize(it->second)); newsig = newsig.extract(0, GetSize(it->second));
} }
cell->setPort(mapped_conn.first, newsig); cell->setPort(mapped_conn.first, newsig);
if (abc9_flop) if (abc9_flop)
continue; continue;
if (cell->input(mapped_conn.first)) { if (cell->input(mapped_conn.first)) {
for (auto i : newsig) for (auto i : newsig)
bit2sinks[i].push_back(cell); bit2sinks[i].push_back(cell);
for (auto i : mapped_conn.second) for (auto i : mapped_conn.second)
bit_users[i].insert(mapped_cell->name); bit_users[i].insert(mapped_cell->name);
} }
if (cell->output(mapped_conn.first)) if (cell->output(mapped_conn.first))
for (auto i : mapped_conn.second) for (auto i : mapped_conn.second)
bit_drivers[i].insert(mapped_cell->name); bit_drivers[i].insert(mapped_cell->name);
} }
if (existing_cell) { if (existing_cell) {
cell->parameters = existing_cell->parameters; cell->parameters = existing_cell->parameters;
cell->attributes = existing_cell->attributes; cell->attributes = existing_cell->attributes;
if (cell->attributes.erase("\\abc9_box_seq")) { if (cell->attributes.erase("\\abc9_box_seq")) {
module->swap_names(cell, existing_cell); module->swap_names(cell, existing_cell);
module->remove(existing_cell); module->remove(existing_cell);
} }
} }
else { else {
cell->parameters = mapped_cell->parameters; cell->parameters = mapped_cell->parameters;
cell->attributes = mapped_cell->attributes; cell->attributes = mapped_cell->attributes;
} }
} }
@ -595,7 +595,7 @@ void reintegrate(RTLIL::Module *module)
RTLIL::Wire *wire = module->wire(port); RTLIL::Wire *wire = module->wire(port);
log_assert(wire); log_assert(wire);
RTLIL::Wire *remap_wire = module->wire(remap_name(port)); RTLIL::Wire *remap_wire = module->wire(remap_name(port));
RTLIL::SigSpec signal = RTLIL::SigSpec(wire, 0, GetSize(remap_wire)); RTLIL::SigSpec signal(wire, 0, GetSize(remap_wire));
log_assert(GetSize(signal) >= GetSize(remap_wire)); log_assert(GetSize(signal) >= GetSize(remap_wire));
RTLIL::SigSig conn; RTLIL::SigSig conn;