HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
functional_candidate.cpp
Go to the documentation of this file.
2 
7 
8 namespace hal
9 {
10  namespace module_identification
11  {
13  {
15  m_gates = sc->m_gates;
16  m_candidate_type = candidate_type;
18 
21 
22  m_max_control_signals = max_control_signal;
23  m_max_operands = 0;
24  m_ctrl_to_operand_net = nullptr;
25 
26  m_control_signals = {};
27  m_control_mapping = {};
28 
31 
34 
35  m_sign_nets = {};
36 
37  m_operands = {};
38 
39  m_additional_data = {};
40 
41  m_timings = {};
42  }
43 
44  void FunctionalCandidate::add_additional_data(std::string key, std::string value)
45  {
46  if (m_additional_data.find(key) != m_additional_data.end())
47  {
48  m_additional_data[key] = m_additional_data[key] + "\n" + value;
49  }
50  else
51  {
52  m_additional_data[key] = value;
53  }
54  }
55 
56  std::map<std::string, std::string> FunctionalCandidate::get_all_additional_data() const
57  {
58  return m_additional_data;
59  }
60 
62  {
63  std::string result = "";
64  //result += "Verified: " + std::to_string(m_verified) + "\n";
65  result += "Candidate Type: " + enum_to_string(m_candidate_type) + "\n";
66  for (const auto& nets : m_operands)
67  {
68  result += "OPERAND [" + std::to_string(nets.size()) + "]" + ": \n";
69  for (const auto& net : nets)
70  {
71  result += "\t" + net->get_name() + " - " + std::to_string(net->get_id()) + "\n";
72  }
73  }
74  result += "OUTPUT: [" + std::to_string(m_output_nets.size()) + "]\n";
75  for (auto n : m_output_nets)
76  {
77  result += "\t" + n->get_name() + " / " + std::to_string(n->get_id()) + "\n";
78  }
79  result += "CONTROL SIGNALS: [" + std::to_string(m_control_signals.size()) + "]\n";
80  result += "\t" + utils::join(", ", m_control_signals, [](const auto& n) { return n->get_name(); }) + "\n";
81  result += "CONTROL MAPPING: \n";
82  for (const auto& [n, v] : m_control_mapping)
83  {
84  result += "\t" + n->get_name() + " / " + std::to_string(n->get_id()) + " : " + std::to_string(v) + "\n";
85  }
86  // result += "ADDITIONAL DATA: \n";
87  // for (const auto& [key, data] : m_additional_data)
88  // {
89  // result += "\t" + key + ": " + data + "\n";
90  // }
91 
92  return result;
93  }
94 
95  } // namespace module_identification
96 } // namespace hal
This file contains the definition of the BaseCandidate class, which represents a base candidate in th...
std::vector< Gate * > m_gates
A vector of Gate pointers representing the gates included in this base candidate.
std::vector< std::pair< Net *, Net * > > m_permuted_single_pairs
std::map< std::string, std::string > get_all_additional_data() const
Get all additional data of the functional candidate.
std::map< u32, std::vector< Net * > > m_influence_count_to_input_nets
std::map< std::string, std::map< std::string, std::map< std::string, std::map< std::string, u64 > > > > m_timings
std::string get_candidate_info() const
Get candidate information as a string.
std::map< u32, std::vector< Net * > > m_input_count_to_output_nets
std::map< Net *, BooleanFunction::Value > m_control_mapping
std::map< std::string, std::string > m_additional_data
module_identification::CandidateType m_candidate_type
FunctionalCandidate(StructuralCandidate *sc, u32 max_control_signal, module_identification::CandidateType candidate_type)
Constructor for FunctionalCandidate.
void add_additional_data(std::string key, std::string value)
Add additional data to the functional candidate.
std::vector< std::vector< Net * > > m_operands
A class representing a structural candidate for module identification.
BaseCandidate * base_candidate
Pointer to the base candidate.
std::vector< Gate * > m_gates
Vector of gates that form the structural candidate.
uint32_t u32
Definition: defines.h:41
This file contains the class and functions for handling functional candidates within the module ident...
std::vector< Net * > get_input_nets(const std::vector< Gate * > &gates)
Get input nets from a list of gates.
Definition: utils.cpp:25
CandidateType
Enumeration of the different candidate types for module identification.
std::vector< Net * > get_output_nets(const std::vector< Gate * > &gates, bool only_external_destinations=true)
Get output nets from a list of gates.
Definition: utils.cpp:61
std::string join(const std::string &joiner, const Iterator &begin, const Iterator &end, const Transform &transform)
Definition: utils.h:414
Definition: defines.h:45
std::string enum_to_string(T e)
Definition: enums.h:53
Net * net
This file contains all functions related to the HAL plugin API.
This file contains helper functions for module identification in the HAL framework.