HAL
hal::boolean_influence Namespace Reference

Functions

Result< std::unordered_map< std::string, double > > get_boolean_influence (const BooleanFunction &bf, const u32 num_evaluations=32000)
 
Result< std::unordered_map< std::string, double > > get_boolean_influence_with_hal_boolean_function_class (const BooleanFunction &bf, const u32 num_evaluations)
 
Result< std::unordered_map< std::string, double > > get_boolean_influence_with_z3_expr (const BooleanFunction &bf, const u32 num_evaluations)
 
Result< std::unordered_map< std::string, double > > get_boolean_influence (const z3::expr &e, const u32 num_evaluations=32000)
 
Result< std::unordered_map< std::string, double > > get_boolean_influence_deterministic (const BooleanFunction &bf)
 
Result< std::unordered_map< std::string, double > > get_boolean_influence_deterministic (const z3::expr &e)
 
Result< std::map< Net *, double > > get_boolean_influences_of_subcircuit (const std::vector< Gate * > &gates, const Net *start_net, const u32 num_evaluations=32000)
 
Result< std::map< Net *, double > > get_boolean_influences_of_gate (const Gate *gate, const u32 num_evaluations=32000)
 
Result< std::map< Net *, double > > get_boolean_influences_of_subcircuit_deterministic (const std::vector< Gate * > &gates, const Net *start_net)
 
Result< std::map< Net *, double > > get_boolean_influences_of_gate_deterministic (const Gate *gate)
 
Result< std::pair< std::map< u32, Gate * >, std::vector< std::vector< double > > > > get_ff_dependency_matrix (const Netlist *netlist, bool with_boolean_influence)
 

Function Documentation

◆ get_boolean_influence() [1/2]

Result< std::unordered_map< std::string, double > > hal::boolean_influence::get_boolean_influence ( const BooleanFunction bf,
const u32  num_evaluations = 32000 
)

Generates the Boolean influence of each input variable of a Boolean function.

Parameters
[in]bf- The Boolean function.
[in]num_evaluations- The amount of evaluations that are performed for each input variable.
Returns
A map from the variables that appear in the function to their Boolean influence on said function on success, an error otherwise.

Definition at line 407 of file boolean_influence.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_boolean_influence() [2/2]

Result< std::unordered_map< std::string, double > > hal::boolean_influence::get_boolean_influence ( const z3::expr &  e,
const u32  num_evaluations = 32000 
)

Generates the Boolean influence of each input variable of a Boolean function.

Parameters
[in]e- The z3 expression representing a Boolean function.
[in]num_evaluations- The amount of evaluations that are performed for each input variable.
Returns
A map from the variables that appear in the function to their Boolean influence on said function on success, an error otherwise.

Definition at line 415 of file boolean_influence.cpp.

◆ get_boolean_influence_deterministic() [1/2]

Result< std::unordered_map< std::string, double > > hal::boolean_influence::get_boolean_influence_deterministic ( const BooleanFunction bf)

Generates the Boolean influence of each input variable of a Boolean function.

Parameters
[in]bf- The Boolean function.
Returns
A map from the variables that appear in the function to their Boolean influence on said function on success, an error otherwise.

Definition at line 420 of file boolean_influence.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_boolean_influence_deterministic() [2/2]

Result< std::unordered_map< std::string, double > > hal::boolean_influence::get_boolean_influence_deterministic ( const z3::expr &  e)

Generates the Boolean influence of each input variable of a Boolean function.

Parameters
[in]e- The z3 expression representing a Boolean function.
Returns
A map from the variables that appear in the function to their Boolean influence on said function on success, an error otherwise.

Definition at line 428 of file boolean_influence.cpp.

◆ get_boolean_influence_with_hal_boolean_function_class()

Result< std::unordered_map< std::string, double > > hal::boolean_influence::get_boolean_influence_with_hal_boolean_function_class ( const BooleanFunction bf,
const u32  num_evaluations 
)

Generates the Boolean influence of each input variable of a Boolean function using the internal HAL functions only The function is slower, but can be better used in multithreading environment.

Parameters
[in]bf- The Boolean function.
[in]num_evaluations- The amount of evaluations that are performed for each input variable.
Returns
A map from the variables that appear in the function to their Boolean influence on said function on success, an error otherwise.

Definition at line 453 of file boolean_influence.cpp.

References ERR_APPEND, hal::BooleanFunction::evaluate(), hal::BooleanFunction::get_variable_names(), and OK.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_boolean_influence_with_z3_expr()

Result< std::unordered_map< std::string, double > > hal::boolean_influence::get_boolean_influence_with_z3_expr ( const BooleanFunction bf,
const u32  num_evaluations 
)

Generates the Boolean influence of each input variable of a Boolean function using z3 expressions and substitutions/simplifications only. The function is slower, but can be better used in multithreading environment.

Parameters
[in]bf- The Boolean function.
[in]num_evaluations- The amount of evaluations that are performed for each input variable.
Returns
A map from the variables that appear in the function to their Boolean influence on said function on success, an error otherwise.

Definition at line 509 of file boolean_influence.cpp.

References ERR, hal::BooleanFunction::get_variable_names(), and OK.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_boolean_influences_of_gate()

Result< std::map< Net *, double > > hal::boolean_influence::get_boolean_influences_of_gate ( const Gate gate,
const u32  num_evaluations = 32000 
)

Generates the function of the dataport net of the given flip-flop. Afterwards the generated function gets translated from a z3::expr to efficient c code, compiled, executed and evaluated.

Parameters
[in]gate- Pointer to the flip-flop which data input net is used to build the Boolean function.
[in]num_evaluations- The amount of evaluations that are performed for each input variable.
Returns
A map from the nets that appear in the function of the data net to their Boolean influence on said function on success, an error otherwise.

Definition at line 438 of file boolean_influence.cpp.

Referenced by get_ff_dependency_matrix(), and hal::PYBIND11_PLUGIN().

◆ get_boolean_influences_of_gate_deterministic()

Result< std::map< Net *, double > > hal::boolean_influence::get_boolean_influences_of_gate_deterministic ( const Gate gate)

Generates the function of the dataport net of the given flip-flop. Afterwards the generated function gets translated from a z3::expr to efficient c code, compiled, executed and evaluated.

Parameters
[in]gate- Pointer to the flip-flop which data input net is used to build the Boolean function.
Returns
A map from the nets that appear in the function of the data net to their Boolean influence on said function on success, an error otherwise.

Definition at line 448 of file boolean_influence.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_boolean_influences_of_subcircuit()

Result< std::map< Net *, double > > hal::boolean_influence::get_boolean_influences_of_subcircuit ( const std::vector< Gate * > &  gates,
const Net start_net,
const u32  num_evaluations = 32000 
)

Generates the function of the net using only the given gates. Afterwards the generated function gets translated from a z3::expr to efficient c code, compiled, executed and evaluated.

Parameters
[in]gates- The gates of the subcircuit.
[in]start_net- The output net of the subcircuit at which to start the analysis.
[in]num_evaluations- The amount of evaluations that are performed for each input variable.
Returns
A map from the nets that appear in the function of the start net to their Boolean influence on said function on success, an error otherwise.

Definition at line 433 of file boolean_influence.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_boolean_influences_of_subcircuit_deterministic()

Result< std::map< Net *, double > > hal::boolean_influence::get_boolean_influences_of_subcircuit_deterministic ( const std::vector< Gate * > &  gates,
const Net start_net 
)

Generates the function of the net using only the given gates. Afterwards the generated function gets translated from a z3::expr to efficient c code, compiled, executed and evaluated.

Parameters
[in]gates- The gates of the subcircuit.
[in]start_net- The output net of the subcircuit at which to start the analysis.
Returns
A map from the nets that appear in the function of the start net to their Boolean influence on said function on success, an error otherwise.

Definition at line 443 of file boolean_influence.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_ff_dependency_matrix()

Result< std::pair< std::map< u32, Gate * >, std::vector< std::vector< double > > > > hal::boolean_influence::get_ff_dependency_matrix ( const Netlist netlist,
bool  with_boolean_influence 
)

Get the FF dependency matrix of a netlist.

Parameters
[in]netlist- The netlist to extract the dependency matrix from.
[in]with_boolean_influence- True – set Boolean influence, False – sets 1.0 if connection between FFs
Returns
A pair consisting of std::map<u32, Gate*>, which includes the mapping from the original gate IDs to the ones in the matrix, and a std::vector<std::vector<double>, which is the ff dependency matrix

Definition at line 586 of file boolean_influence.cpp.

References ERR_APPEND, hal::ff, get_boolean_influences_of_gate(), hal::Gate::get_fan_out_nets(), hal::Netlist::get_gates(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), log_info, and OK.

Referenced by hal::PYBIND11_PLUGIN().