From 9f74e1bd2b90216aa1302810324f6af9a0473876 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Thu, 10 Apr 2025 11:35:19 +0200 Subject: [PATCH] Revert "opt_clean: handle undriven and x-bit driven bits consistently" This reverts commit 8eb48fe44663e2a626199a7cd40c24360ce0c0a4. --- passes/opt/opt_clean.cc | 22 ++++------------------ tests/opt/opt_clean_x.ys | 14 -------------- 2 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 tests/opt/opt_clean_x.ys diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc index 66764dc11..2c5dc91eb 100644 --- a/passes/opt/opt_clean.cc +++ b/passes/opt/opt_clean.cc @@ -31,20 +31,6 @@ PRIVATE_NAMESPACE_BEGIN using RTLIL::id2cstr; -struct CleanerPool : SigPool -{ - bool check_all_def(const RTLIL::SigSpec &sig) const - { - for (auto &bit : sig) { - if (bit.wire != NULL && bits.count(bit) == 0) - return false; - if (bit.wire == NULL && bit.data == RTLIL::State::Sx) - return false; - } - return true; - } -}; - struct keep_cache_t { Design *design; @@ -404,7 +390,7 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool x_mode // used signals pre-sigmapped SigPool raw_used_signals; // used signals sigmapped, ignoring drivers (we keep track of this to set `unused_bits`) - CleanerPool used_signals_nodrivers; + SigPool used_signals_nodrivers; // gather the usage information for cells for (auto &it : module->cells_) { @@ -520,14 +506,14 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool x_mode module->connect(new_conn); } - if (!used_signals_nodrivers.check_all_def(s2)) { + if (!used_signals_nodrivers.check_all(s2)) { std::string unused_bits; for (int i = 0; i < GetSize(s2); i++) { - if ((s2[i].wire == NULL) && (s2[i].data != RTLIL::State::Sx)) + if (s2[i].wire == NULL) continue; if (!used_signals_nodrivers.check(s2[i])) { if (!unused_bits.empty()) - unused_bits += " "; + unused_bits += " "; unused_bits += stringf("%d", i); } } diff --git a/tests/opt/opt_clean_x.ys b/tests/opt/opt_clean_x.ys deleted file mode 100644 index 68a1ad4fb..000000000 --- a/tests/opt/opt_clean_x.ys +++ /dev/null @@ -1,14 +0,0 @@ -read_verilog <