35 for (
size_t i = 0; i < sw->
cases.size(); i++)
39 for (
size_t j = 0; j < sw->
cases[i]->compare.size(); j++) {
44 sw->
cases[i]->compare.erase(sw->
cases[i]->compare.begin() + (j--));
48 if (sw->
cases[i]->compare.size() == 0) {
55 sw->
cases[i]->compare.clear();
58 for (
auto switch_it : sw->
cases[i]->switches)
72 log(
" proc_rmdead [selection]\n");
74 log(
"This pass identifies unreachable branches in decision trees and removes them.\n");
79 log_header(
"Executing PROC_RMDEAD pass (remove dead branches from decision trees).\n");
83 int total_counter = 0;
84 for (
auto mod : design->
modules()) {
87 for (
auto &proc_it : mod->processes) {
88 if (!design->
selected(mod, proc_it.second))
91 for (
auto switch_it : proc_it.second->root_case.switches)
94 log(
"Removed %d dead cases from process %s in module %s.\n", counter,
95 proc_it.first.c_str(),
log_id(mod));
96 total_counter += counter;
100 log(
"Removed a total of %d dead cases.\n", total_counter);
bool selected(T1 *module) const
ProcRmdeadPass ProcRmdeadPass
void log_header(const char *format,...)
RTLIL_ATTRIBUTE_MEMBERS std::vector< RTLIL::CaseRule * > cases
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN void proc_rmdead(RTLIL::SwitchRule *sw, int &counter)
#define PRIVATE_NAMESPACE_BEGIN
int GetSize(RTLIL::Wire *wire)
bool is_fully_const() const
#define PRIVATE_NAMESPACE_END
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
#define USING_YOSYS_NAMESPACE
RTLIL::ObjRange< RTLIL::Module * > modules()
void log(const char *format,...)
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
bool take(RTLIL::SigSpec sig)
const char * log_id(RTLIL::IdString str)