HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
verified_candidate.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <map>
7 #include <string>
8 #include <vector>
9 
10 namespace hal
11 {
12  class Net;
13  class Gate;
14 
15  namespace module_identification
16  {
17  enum class CandidateType;
18 
26  {
30  std::map<std::string, BooleanFunction> operands;
31 
35  std::vector<BooleanFunction> ctrl_signals;
36 
41  };
42 
50  {
51  public:
65  VerifiedCandidate(const std::vector<std::vector<Net*>>& operands,
66  const std::vector<Net*>& output_nets,
67  const std::vector<Net*>& control_signals,
68  const std::vector<std::map<Net*, BooleanFunction::Value>>& control_signal_mappings,
69  const std::map<std::map<Net*, BooleanFunction::Value>, BooleanFunction>& word_level_operations,
70  const std::vector<Gate*>& gates,
71  const std::vector<Gate*>& base_gates,
72  const std::map<std::string, std::string>& additional_data,
73  const std::set<CandidateType>& types);
74 
79 
88  bool operator==(const VerifiedCandidate& other) const
89  {
91  && (m_output_nets == other.m_output_nets) && (m_gates == other.m_gates) && (m_types == other.m_types) && (m_verified == other.m_verified);
92  }
93 
102  static hal::Result<VerifiedCandidate> merge(const std::vector<VerifiedCandidate>& candidates);
103 
109  std::string get_candidate_info() const;
110 
116  bool is_verified() const;
117 
123  std::string get_name() const;
124 
133 
137  std::vector<std::vector<Net*>> m_operands;
138 
142  std::vector<Net*> m_output_nets;
143 
147  std::vector<Net*> m_control_signals;
148 
152  std::vector<std::map<Net*, BooleanFunction::Value>> m_control_signal_mappings;
153 
157  std::map<std::map<Net*, BooleanFunction::Value>, BooleanFunction> m_word_level_operations;
158 
162  std::vector<Gate*> m_gates;
163 
167  std::vector<Gate*> m_base_gates;
168 
172  std::vector<Net*> m_total_input_nets;
173 
177  std::vector<Net*> m_total_output_nets;
178 
182  std::set<CandidateType> m_types;
183 
188 
189  // void add_additional_data(std::string key, std::string value);
190  // std::map<std::string, std::string> get_all_additional_data() const;
191 
192  private:
196  std::map<std::string, std::string> m_additional_data;
197  };
198  } // namespace module_identification
199 } // namespace hal
Represents a verified candidate for module identification.
bool is_verified() const
Check if the candidate is verified.
std::string get_name() const
Get the name of the candidate that represents the functionality of the candidate.
BooleanFunction get_merged_word_level_operation() const
Get the merged word-level operation for the candidate.
bool operator==(const VerifiedCandidate &other) const
Equality comparison operator for two verified candidates.
VerifiedCandidate()
Default constructor for an empty/unverified VerifiedCandidate.
std::vector< std::map< Net *, BooleanFunction::Value > > m_control_signal_mappings
std::string get_candidate_info() const
Get the candidate information as a string.
std::map< std::map< Net *, BooleanFunction::Value >, BooleanFunction > m_word_level_operations
static hal::Result< VerifiedCandidate > merge(const std::vector< VerifiedCandidate > &candidates)
Merge multiple verified candidates into a single candidate.
std::vector< std::vector< Net * > > m_operands
CandidateType
Enumeration of the different candidate types for module identification.
Definition: defines.h:45
Represents a word-level operation with its operands, control signals, and the operation implemented a...
BooleanFunction operation
The Boolean function representing the word-level operation.
std::map< std::string, BooleanFunction > operands
A map of operand names to their corresponding Boolean functions.
std::vector< BooleanFunction > ctrl_signals
A vector of control signals as Boolean functions.