HAL
merge_states.cpp
Go to the documentation of this file.
2 
7 
8 namespace hal
9 {
10  namespace dataflow
11  {
12  namespace merge_states
13  {
14  std::shared_ptr<Grouping>
15  process(const processing::Configuration& config, const std::shared_ptr<const Grouping>& state1, const std::shared_ptr<const Grouping>& state2, bool delete_from_smaller)
16  {
17  auto new_state = std::make_shared<Grouping>(state1->netlist_abstr);
18 
19  u32 id_counter = -1;
20 
21  for (const auto& state : {state1, state2})
22  {
23  for (const auto& [group_id, gates] : state->gates_of_group)
24  {
25  u32 new_group_id = ++id_counter;
26 
27  new_state->group_control_fingerprint_map[new_group_id] = new_state->netlist_abstr.gate_to_fingerprint.at(*gates.begin());
28  new_state->operations_on_group_allowed[new_group_id] = state->operations_on_group_allowed.at(group_id);
29 
30  new_state->gates_of_group[new_group_id].insert(gates.begin(), gates.end());
31  for (const auto& sg : gates)
32  {
33  new_state->parent_group_of_gate[sg] = new_group_id;
34  }
35  }
36  }
37 
38  new_state = remove_duplicates::process(config, new_state, delete_from_smaller);
39 
40  return new_state;
41  } // namespace merge_states
42 
43  } // namespace merge_states
44  } // namespace dataflow
45 } // namespace hal
std::shared_ptr< Grouping > process(const processing::Configuration &config, const std::shared_ptr< const Grouping > &state1, const std::shared_ptr< const Grouping > &state2, bool delete_from_smaller)
std::shared_ptr< Grouping > process(const processing::Configuration &config, const std::shared_ptr< Grouping > &state, bool delete_from_smaller)
quint32 u32
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.