aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt/opt_clean.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-05-03 09:12:10 +0200
committerClifford Wolf <clifford@clifford.at>2019-05-03 09:12:10 +0200
commitf12e1155f1d77443ee9d876d5ba3d407b9447540 (patch)
tree5572a97cf88cc63a3e9f69fd8e2736abc56da574 /passes/opt/opt_clean.cc
parente5cb9435a064461b56d55dc6ba1241ba1f179119 (diff)
downloadyosys-f12e1155f1d77443ee9d876d5ba3d407b9447540.tar.gz
yosys-f12e1155f1d77443ee9d876d5ba3d407b9447540.tar.bz2
yosys-f12e1155f1d77443ee9d876d5ba3d407b9447540.zip
Improve unused-detection for opt_clean driver-driver conflict warning
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes/opt/opt_clean.cc')
-rw-r--r--passes/opt/opt_clean.cc50
1 files changed, 29 insertions, 21 deletions
diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc
index 242680290..f287fdcff 100644
--- a/passes/opt/opt_clean.cc
+++ b/passes/opt/opt_clean.cc
@@ -97,21 +97,19 @@ void rmunused_module_cells(Module *module, bool verbose)
for (auto &it : module->cells_) {
Cell *cell = it.second;
for (auto &it2 : cell->connections()) {
- if (!ct_all.cell_known(cell->type) || ct_all.cell_output(cell->type, it2.first))
- for (auto raw_bit : it2.second) {
- if (raw_bit.wire == nullptr)
- continue;
- auto bit = sigmap(raw_bit);
- if (bit.wire == nullptr)
- driver_driver_logs[raw_bit].push_back(stringf("Driver-driver conflict "
- "for %s between cell %s.%s and constant %s in %s: Resolved using constant.",
- log_signal(raw_bit), log_id(cell), log_id(it2.first), log_signal(bit), log_id(module)));
- if (bit.wire != nullptr)
- wire2driver[bit].insert(cell);
- }
- if (!ct_all.cell_known(cell->type) || ct_all.cell_input(cell->type, it2.first))
- for (auto raw_bit : it2.second)
- used_raw_bits.insert(raw_bit);
+ if (ct_all.cell_known(cell->type) && !ct_all.cell_output(cell->type, it2.first))
+ continue;
+ for (auto raw_bit : it2.second) {
+ if (raw_bit.wire == nullptr)
+ continue;
+ auto bit = sigmap(raw_bit);
+ if (bit.wire == nullptr)
+ driver_driver_logs[raw_bit].push_back(stringf("Driver-driver conflict "
+ "for %s between cell %s.%s and constant %s in %s: Resolved using constant.",
+ log_signal(raw_bit), log_id(cell), log_id(it2.first), log_signal(bit), log_id(module)));
+ if (bit.wire != nullptr)
+ wire2driver[bit].insert(cell);
+ }
}
if (keep_cache.query(cell))
queue.insert(cell);
@@ -130,12 +128,6 @@ void rmunused_module_cells(Module *module, bool verbose)
}
}
- for (auto it : driver_driver_logs) {
- if (used_raw_bits.count(it.first))
- for (auto msg : it.second)
- log_warning("%s\n", msg.c_str());
- }
-
while (!queue.empty())
{
pool<SigBit> bits;
@@ -161,6 +153,22 @@ void rmunused_module_cells(Module *module, bool verbose)
module->remove(cell);
count_rm_cells++;
}
+
+ for (auto &it : module->cells_) {
+ Cell *cell = it.second;
+ for (auto &it2 : cell->connections()) {
+ if (ct_all.cell_known(cell->type) && !ct_all.cell_input(cell->type, it2.first))
+ continue;
+ for (auto raw_bit : it2.second)
+ used_raw_bits.insert(raw_bit);
+ }
+ }
+
+ for (auto it : driver_driver_logs) {
+ if (used_raw_bits.count(it.first))
+ for (auto msg : it.second)
+ log_warning("%s\n", msg.c_str());
+ }
}
int count_nontrivial_wire_attrs(RTLIL::Wire *w)