Boolean Influence

class boolean_influence.BooleanInfluencePlugin
static get_boolean_influence(bf: hal_py.BooleanFunction, num_evaluations: int = 32000, unique_identifier: str = '') → Optional[Dict[str, float]]

The Boolean function gets translated to a z3::expr and afterwards efficent c code. The program is compiled and executed many times to meassure the Boolean influence of each input variable.

Parameters:
  • bf (hal_py.BooleanFunction) – The Boolean function.
  • num_evaluations (int) – The amount of evaluations that are performed for each input variable.
  • unique_identifier (str) – A unique identifier that is applied to file names to prevent collisions during multi-threading.
Returns:

A dict from the variables that appear in the function to their Boolean influence on said function on success, None otherwise.

Return type:

dict[str,float] or None

static get_boolean_influence_deterministic(bf: hal_py.BooleanFunction, unique_identifier: str = '') → Optional[Dict[str, float]]

The Boolean function gets translated to a z3::expr and afterwards efficent c code. The program is compiled and executed exactly once for every possible input mapping to accuratley determine the boolean influence of each variable.

Parameters:
  • bf (hal_py.BooleanFunction) – The Boolean function.
  • unique_identifier (str) – A unique identifier that is applied to file names to prevent collisions during multi-threading.
Returns:

A dict from the variables that appear in the function to their Boolean influence on said function on success, None otherwise.

Return type:

dict[str,float] or None

static get_boolean_influences_of_gate(gate: hal_py.Gate, num_evaluations: int = 32000, unique_identifier: str = '') → Optional[Dict[hal_py.Net, float]]

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

Parameters:
  • gate (hal_py.Gate) – The flip-flop which data input net is used to build the boolean function.
  • num_evaluations (int) – The amount of evaluations that are performed for each input variable.
  • unique_identifier (str) – A unique identifier that is applied to file names to prevent collisions during multi-threading.
Returns:

A dict from the nets that appear in the function of the data net to their Boolean influence on said function on success, None otherwise.

Return type:

dict[hal_py.Net,float]

static get_boolean_influences_of_gate_deterministic(gate: hal_py.Gate, unique_identifier: str = '') → Optional[Dict[hal_py.Net, float]]

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

Parameters:
  • gate (hal_py.Gate) – The flip-flop which data input net is used to build the boolean function.
  • unique_identifier (str) – A unique identifier that is applied to file names to prevent collisions during multi-threading.
Returns:

A dict from the nets that appear in the function of the data net to their Boolean influence on said function on success, None otherwise.

Return type:

dict[hal_py.Net,float]

static get_boolean_influences_of_subcircuit(gates: List[hal_py.Gate], start_net: hal_py.Net, num_evaluations: int = 32000, unique_identifier: str = '') → Optional[Dict[hal_py.Net, float]]

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

Parameters:
  • gates (list[hal_py.Gate]) – The gates of the subcircuit.
  • start_net (hal_py.Net) – The output net of the subcircuit at which to start the analysis.
  • num_evaluations (int) – The amount of evaluations that are performed for each input variable.
  • unique_identifier (str) – A unique identifier that is applied to file names to prevent collisions during multi-threading.
Returns:

A dict from the nets that appear in the function of the start net to their Boolean influence on said function on success, None otherwise.

Return type:

dict[hal_py.Net,float] or None

static get_boolean_influences_of_subcircuit_deterministic(gates: List[hal_py.Gate], start_net: hal_py.Net, unique_identifier: str = '') → Optional[Dict[hal_py.Net, float]]

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

Parameters:
  • gates (list[hal_py.Gate]) – The gates of the subcircuit.
  • start_net (hal_py.Net) – The output net of the subcircuit at which to start the analysis.
  • unique_identifier (str) – A unique identifier that is applied to file names to prevent collisions during multi-threading.
Returns:

A dict from the nets that appear in the function of the start net to their Boolean influence on said function on success, None otherwise.

Return type:

dict[hal_py.Net,float] or None

static get_ff_dependency_matrix(netlist: hal_py.Netlist, with_boolean_influence: bool) → Optional[Tuple[Dict[int, hal_py.Gate], List[List[float]]]]

Get the FF dependency matrix of a netlist, with or without boolean influences.

Parameters:
  • netlist (hal_py.Netlist) – The netlist to extract the dependency matrix from.
  • with_boolean_influence (bool) – 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

Return type:

pair(dict(int, hal_py.Gate), list[list[double]])

get_name(self: boolean_influence.BooleanInfluencePlugin) → str
get_version(self: boolean_influence.BooleanInfluencePlugin) → str