44 #define HAL_CANDIDATE_CONTEXT
46 #ifdef Z3_CANDIDATE_CONTEXT
56 namespace module_identification
72 #ifdef HAL_CANDIDATE_CONTEXT
153 evaluate(
const Net* n,
const std::map<Net*, BooleanFunction::Value>& ctrl_mapping,
const std::map<std::string, BooleanFunction::Value>& eval_mapping);
169 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>,
BooleanFunction> m_boolean_function_cache;
174 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>, std::set<std::string>> m_boolean_vars_cache;
179 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>, std::unordered_map<std::string, double>> m_boolean_influence_cache;
182 #ifdef Z3_CANDIDATE_CONTEXT
281 evaluate(
const Net* n,
const std::map<Net*, BooleanFunction::Value>& ctrl_mapping,
const std::map<std::string, BooleanFunction::Value>& eval_mapping);
302 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>,
BooleanFunction> m_boolean_function_hal_cache;
307 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>, z3::expr> m_boolean_function_cache;
312 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>, std::set<std::string>> m_boolean_vars_cache;
317 std::map<std::pair<const Net*, std::map<Net*, BooleanFunction::Value>>, std::unordered_map<std::string, double>> m_boolean_influence_cache;
This struct manages the context of a candidate during module identification, including caches for all...
hal::Result< const std::set< Net * > > get_variable_nets(const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping)
Retrieves the variable nets for a given net and control mapping.
hal::Result< std::unordered_map< std::string, double > > get_boolean_influence(const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping)
Retrieves the boolean influence for a given net and control mapping.
std::vector< Gate * > m_gates
The gates of the corresponding structural candidate.
CandidateContext(const Netlist *nl, const std::vector< Gate * > &gates)
Constructs a new CandidateContext object saving results for one structural candidate.
hal::Result< std::vector< BooleanFunction > > get_boolean_functions_const(const std::vector< Net * > nets, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping) const
Retrieves a set of constant boolean functions for a given set of nets and control mapping.
hal::Result< const BooleanFunction > get_boolean_function_const(const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping) const
Retrieves a constant boolean function for a given net and control mapping.
hal::Result< std::monostate > populate_boolean_function_cache(const std::vector< Net * > nets)
Populates the boolean function cache for a set of nets.
const Netlist * m_netlist
The netlist associated with the candidate context.
hal::Result< const BooleanFunction > get_boolean_function(const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping)
Retrieves a boolean function for a given net and control mapping.
hal::Result< std::vector< BooleanFunction::Value > > evaluate(const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping, const std::map< std::string, BooleanFunction::Value > &eval_mapping)
Evaluates the boolean function for a given net, control mapping, and evaluation mapping.
hal::Result< const std::set< std::string > > get_variable_names(const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping)
Retrieves the variable names for a given net and control mapping.
hal::Result< std::vector< BooleanFunction > > get_boolean_functions(const std::vector< Net * > nets, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping)
Retrieves a set of boolean functions for a given set of nets and control mapping.