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

proc_prune: Promote partially redundant assignments.

This commit is contained in:
Jean-François Nguyen 2019-07-31 14:26:09 +02:00
parent acd8bc0a74
commit 320bf2fde5

View file

@ -82,14 +82,23 @@ struct PruneWorker
if (root) { if (root) {
bool promotable = true; bool promotable = true;
for (auto &bit : lhs) { for (auto &bit : lhs) {
if (bit.wire && affected[bit]) { if (bit.wire && affected[bit] && !assigned[bit]) {
promotable = false; promotable = false;
break; break;
} }
} }
if (promotable) { if (promotable) {
RTLIL::SigSpec rhs = sigmap(it->second);
RTLIL::SigSig conn;
for (int i = 0; i < GetSize(lhs); i++) {
RTLIL::SigBit lhs_bit = lhs[i];
if (lhs_bit.wire && !assigned[lhs_bit]) {
conn.first.append_bit(lhs_bit);
conn.second.append(rhs.extract(i));
}
}
promoted_count++; promoted_count++;
module->connect(*it); module->connect(conn);
remove.insert(*it); remove.insert(*it);
} }
} }