diff --git a/passes/cmds/abstract.cc b/passes/cmds/abstract.cc index 706636d59..743ff2dd8 100644 --- a/passes/cmds/abstract.cc +++ b/passes/cmds/abstract.cc @@ -43,10 +43,7 @@ bool abstract_state_port(FfData& ff, SigSpec& port_sig, std::set offsets, E return true; } -unsigned int abstract_state(Module* mod, EnableLogic enable) { - CellTypes ct; - ct.setup_internals_ff(); - SigMap sigmap(mod); +pool gather_selected_reps(Module* mod, SigMap& sigmap) { pool selected_representatives; // Collect reps for all wire bits of selected wires @@ -60,6 +57,14 @@ unsigned int abstract_state(Module* mod, EnableLogic enable) { if (cell->output(conn.first)) for (auto bit : conn.second.bits()) selected_representatives.insert(sigmap(bit)); + return selected_representatives; +} + +unsigned int abstract_state(Module* mod, EnableLogic enable) { + CellTypes ct; + ct.setup_internals_ff(); + SigMap sigmap(mod); + pool selected_representatives = gather_selected_reps(mod, sigmap); unsigned int changed = 0; std::vector ffs;