14 namespace group_by_control_signals
18 auto new_state = std::make_shared<Grouping>(
state->netlist_abstr);
21 std::map<std::set<u32>, std::unordered_set<u32>> characteristics_map;
22 for (
const auto& [group_id, gates] :
state->gates_of_group)
24 std::set<u32> candidate_characteristic_set;
25 for (
const auto& [_, signals] :
state->get_control_signals_of_group(group_id))
27 candidate_characteristic_set.insert(signals.begin(), signals.end());
29 characteristics_map[candidate_characteristic_set].insert(group_id);
33 std::vector<std::vector<u32>> merge_sets;
34 for (
auto& merge_candidates : characteristics_map)
36 auto& work_list = merge_candidates.second;
37 while (!work_list.empty())
39 auto it = work_list.begin();
41 it = work_list.erase(it);
43 std::vector<u32> merge_set = {group_id};
45 while (it != work_list.end())
47 auto test_group_id = *it;
55 merge_set.push_back(test_group_id);
56 it = work_list.erase(it);
58 merge_sets.push_back(merge_set);
64 for (
const auto& groups_to_merge : merge_sets)
66 u32 new_group_id = ++id_counter;
68 for (
const auto& old_group : groups_to_merge)
70 auto gates =
state->gates_of_group.at(old_group);
71 new_state->group_control_fingerprint_map[new_group_id] = new_state->netlist_abstr.gate_to_fingerprint.at(*gates.begin());
72 new_state->operations_on_group_allowed[new_group_id] =
state->operations_on_group_allowed.at(old_group);
73 new_state->gates_of_group[new_group_id].insert(gates.begin(), gates.end());
74 for (
const auto& sg : gates)
76 new_state->parent_group_of_gate[sg] = new_group_id;
std::shared_ptr< Grouping > process(const processing::Configuration &config, const std::shared_ptr< Grouping > &state)
This file contains the struct that holds all information on the netlist abstraction used for dataflow...
This file contains the class that holds all information of a dataflow analysis grouping.
bool enforce_type_consistency