aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2019-08-03 07:08:41 +0000
committerGitHub <noreply@github.com>2019-08-03 07:08:41 +0000
commit44a9dcbbbf47f1a6f524c6328ff775f29573a935 (patch)
treeb425ec65d46b8a095ffb42b7db5b07dcb08c48be
parent0917a5cf720e76a85cd2fa4d8cd3cf9434bdee8f (diff)
parent320bf2fde55f72e7c0b35a0d9452e3777f13183d (diff)
downloadyosys-44a9dcbbbf47f1a6f524c6328ff775f29573a935.tar.gz
yosys-44a9dcbbbf47f1a6f524c6328ff775f29573a935.tar.bz2
yosys-44a9dcbbbf47f1a6f524c6328ff775f29573a935.zip
Merge pull request #1242 from jfng/fix-proc_prune-partial
proc_prune: Promote partially redundant assignments.
-rw-r--r--passes/proc/proc_prune.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/passes/proc/proc_prune.cc b/passes/proc/proc_prune.cc
index 9e00b0a8a..b47ee79c2 100644
--- a/passes/proc/proc_prune.cc
+++ b/passes/proc/proc_prune.cc
@@ -82,14 +82,23 @@ struct PruneWorker
if (root) {
bool promotable = true;
for (auto &bit : lhs) {
- if (bit.wire && affected[bit]) {
+ if (bit.wire && affected[bit] && !assigned[bit]) {
promotable = false;
break;
}
}
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++;
- module->connect(*it);
+ module->connect(conn);
remove.insert(*it);
}
}