HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::module_identification::CandidateContext Struct Reference

This struct manages the context of a candidate during module identification, including caches for all Boolean function related and expensive oprations that are populated during the functional candidate generation. More...

#include </home/runner/work/hal/hal/plugins/module_identification/include/module_identification/candidates/candidate_context.h>

Collaboration diagram for hal::module_identification::CandidateContext:
Collaboration graph

Public Member Functions

 CandidateContext (const Netlist *nl, const std::vector< Gate * > &gates)
 Constructs a new CandidateContext object saving results for one structural candidate. More...
 
hal::Result< std::monostate > populate_boolean_function_cache (const std::vector< Net * > nets)
 Populates the boolean function cache for a set of nets. More...
 
hal::Result< const BooleanFunctionget_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. More...
 
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. More...
 
hal::Result< const BooleanFunctionget_boolean_function (const Net *n, const std::map< Net *, BooleanFunction::Value > &ctrl_mapping)
 Retrieves a boolean function for a given net and control mapping. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Public Attributes

std::vector< Gate * > m_gates
 The gates of the corresponding structural candidate. More...
 
const Netlistm_netlist
 The netlist associated with the candidate context. More...
 

Detailed Description

This struct manages the context of a candidate during module identification, including caches for all Boolean function related and expensive oprations that are populated during the functional candidate generation.

Definition at line 62 of file candidate_context.h.

Constructor & Destructor Documentation

◆ CandidateContext()

hal::module_identification::CandidateContext::CandidateContext ( const Netlist nl,
const std::vector< Gate * > &  gates 
)

Constructs a new CandidateContext object saving results for one structural candidate.

Parameters
[in]nl- The netlist associated with the candidate context.
[in]gates- The gates of the structural canidate.

Definition at line 11 of file candidate_context.cpp.

Member Function Documentation

◆ evaluate()

hal::Result<std::vector<BooleanFunction::Value> > hal::module_identification::CandidateContext::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.

Parameters
[in]n- The net to evaluate the boolean function for.
[in]ctrl_mapping- The control mapping to apply to the function.
[in]eval_mapping- The evaluation mapping for the boolean function.
Returns
OK() and a vector of boolean function values incase of success, an error otherwise.

Referenced by hal::module_identification::FunctionalCandidate::early_abort().

◆ get_boolean_function()

hal::Result<const BooleanFunction> hal::module_identification::CandidateContext::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.

Parameters
[in]n- The net to retrieve the boolean function for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and the boolean function incase of success, an error otherwise.

Referenced by hal::module_identification::FunctionalCandidate::order_input_operands().

◆ get_boolean_function_const()

hal::Result<const BooleanFunction> hal::module_identification::CandidateContext::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.

Parameters
[in]n- The net to retrieve the boolean function for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and the boolean function or indicating failure.

◆ get_boolean_functions()

hal::Result<std::vector<BooleanFunction> > hal::module_identification::CandidateContext::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.

Parameters
[in]nets- The nets to retrieve the boolean functions for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and a vector of boolean functions incase of success, an error otherwise.

◆ get_boolean_functions_const()

hal::Result<std::vector<BooleanFunction> > hal::module_identification::CandidateContext::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.

Parameters
[in]nets- The nets to retrieve the boolean functions for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and a vector of boolean functions or indicating failure.

◆ get_boolean_influence()

hal::Result<std::unordered_map<std::string, double> > hal::module_identification::CandidateContext::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.

Parameters
[in]n- The net to retrieve the boolean influence for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and a map of variable names to influence values incase of success, an error otherwise.

Referenced by hal::module_identification::FunctionalCandidate::create_sign_extension_variants(), and hal::module_identification::FunctionalCandidate::find_control_signals().

◆ get_variable_names()

hal::Result<const std::set<std::string> > hal::module_identification::CandidateContext::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.

Parameters
[in]n- The net to retrieve the variable names for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and a set of variable names incase of success, an error otherwise.

Referenced by hal::module_identification::FunctionalCandidate::discard_equal_candidate().

◆ get_variable_nets()

hal::Result<const std::set<Net*> > hal::module_identification::CandidateContext::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.

Parameters
[in]n- The net to retrieve the variable nets for.
[in]ctrl_mapping- The control mapping to apply to the function.
Returns
OK() and a set of variable nets incase of success, an error otherwise.

Referenced by hal::module_identification::FunctionalCandidate::add_selected_shifted_operand(), hal::module_identification::FunctionalCandidate::order_input_operands(), and hal::module_identification::FunctionalCandidate::update_input_output_stats().

◆ populate_boolean_function_cache()

hal::Result<std::monostate> hal::module_identification::CandidateContext::populate_boolean_function_cache ( const std::vector< Net * >  nets)

Populates the boolean function cache for a set of nets.

Parameters
[in]nets- The nets to populate the boolean function cache for.
Returns
OK() incase of success, an error otherwise.

Referenced by hal::module_identification::generate_functional_candidates().

Member Data Documentation

◆ m_gates

std::vector<Gate*> hal::module_identification::CandidateContext::m_gates

The gates of the corresponding structural candidate.

Definition at line 158 of file candidate_context.h.

Referenced by hal::module_identification::generate_functional_candidates().

◆ m_netlist

const Netlist* hal::module_identification::CandidateContext::m_netlist

The netlist associated with the candidate context.

Definition at line 163 of file candidate_context.h.

Referenced by hal::module_identification::FunctionalCandidate::create_input_extension_variants().


The documentation for this struct was generated from the following files: