HAL
hal::BooleanFunctionDecorator Class Reference

#include <boolean_function_decorator.h>

Collaboration diagram for hal::BooleanFunctionDecorator:
Collaboration graph

Public Member Functions

 BooleanFunctionDecorator (const BooleanFunction &bf)
 
Result< BooleanFunctionsubstitute_power_ground_nets (const Netlist *nl) const
 
Result< BooleanFunctionsubstitute_power_ground_pins (const Gate *g) const
 
Result< BooleanFunctionsubstitute_module_pins (const std::vector< Module * > &modules) const
 

Static Public Member Functions

static Result< BooleanFunctionget_boolean_function_from (const std::vector< BooleanFunction > &functions, u32 extend_to_size=0, bool sign_extend=false)
 
static Result< BooleanFunctionget_boolean_function_from (const std::vector< Net * > &nets, u32 extend_to_size=0, bool sign_extend=false)
 
static Result< BooleanFunctionget_boolean_function_from (const PinGroup< ModulePin > *pin_group, u32 extend_to_size=0, bool sign_extend=false)
 

Detailed Description

A Boolean function decorator that provides functionality to operate on the associated Boolean function.

Definition at line 42 of file boolean_function_decorator.h.

Constructor & Destructor Documentation

◆ BooleanFunctionDecorator()

hal::BooleanFunctionDecorator::BooleanFunctionDecorator ( const BooleanFunction bf)

Construct new BooleanFunction object.

Parameters
[in]bf- The Boolean function to operate on.

Definition at line 12 of file boolean_function_decorator.cpp.

Member Function Documentation

◆ get_boolean_function_from() [1/3]

Result< BooleanFunction > hal::BooleanFunctionDecorator::get_boolean_function_from ( const PinGroup< ModulePin > *  pin_group,
u32  extend_to_size = 0,
bool  sign_extend = false 
)
static

Get the Boolean function that is the concatenation of variable names corresponding to the nets connected to the pins of the given pin group. The Boolean function can optionally be extended to any desired size greater the size of the given Boolean function vector.

Parameters
[in]pin_group- The module pin group.
[in]extend_to_size- The size to which to extend the Boolean function. Set to 0 to prevent extension. Defaults to 0.
[in]sign_extend- Set true to sign extend, false to zero extend. Defaults to false.
Returns
The resulting Boolean function on success, an error otherwise.

Definition at line 268 of file boolean_function_decorator.cpp.

References get_boolean_function_from(), hal::PinGroup< T >::get_pins(), and pins.

◆ get_boolean_function_from() [2/3]

Result< BooleanFunction > hal::BooleanFunctionDecorator::get_boolean_function_from ( const std::vector< BooleanFunction > &  functions,
u32  extend_to_size = 0,
bool  sign_extend = false 
)
static

Get the Boolean function that is the concatenation of Boolean functions. The Boolean function can optionally be extended to any desired size greater the size of the given Boolean function vector.

Parameters
[in]functions- The Boolean functions to concatenate.
[in]extend_to_size- The size to which to extend the Boolean function. Set to 0 to prevent extension. Defaults to 0.
[in]sign_extend- Set true to sign extend, false to zero extend. Defaults to false.
Returns
The resulting Boolean function on success, an error otherwise.

Definition at line 149 of file boolean_function_decorator.cpp.

References hal::BooleanFunction::Concat(), ERR, ERR_APPEND, hal::BooleanFunction::Index(), OK, hal::BooleanFunction::Sext(), and hal::BooleanFunction::Zext().

Referenced by hal::boolean_function_decorator_init(), and get_boolean_function_from().

◆ get_boolean_function_from() [3/3]

Result< BooleanFunction > hal::BooleanFunctionDecorator::get_boolean_function_from ( const std::vector< Net * > &  nets,
u32  extend_to_size = 0,
bool  sign_extend = false 
)
static

Get the Boolean function that is the concatenation of variable names corresponding to nets of a netlist. The Boolean function can optionally be extended to any desired size greater the size of the given net vector.

Parameters
[in]nets- The nets to concatenate.
[in]extend_to_size- The size to which to extend the Boolean function. Set to 0 to prevent extension. Defaults to 0.
[in]sign_extend- Set true to sign extend, false to zero extend. Defaults to false.
Returns
The resulting Boolean function on success, an error otherwise.

Definition at line 205 of file boolean_function_decorator.cpp.

References hal::BooleanFunction::Concat(), ERR, ERR_APPEND, hal::BooleanFunctionNetDecorator::get_boolean_variable_name(), hal::BooleanFunction::Index(), OK, hal::BooleanFunction::Sext(), hal::BooleanFunction::Var(), and hal::BooleanFunction::Zext().

◆ substitute_module_pins()

Result< BooleanFunction > hal::BooleanFunctionDecorator::substitute_module_pins ( const std::vector< Module * > &  modules) const

Substitute all Boolean function variables that are either 1) output or 2) input nets to one of the passed module with a BooleanFunction of the form Extract(Var(<module_name>_<pin_group_name>), index, index). This allows a simplification in case multiple pins of the same pin group are concatenated.

Parameters
[in]nl- The netlist to operate on.
Returns
The resulting Boolean function on success, an error otherwise.

Definition at line 101 of file boolean_function_decorator.cpp.

References hal::BooleanFunction::clone(), ERR, hal::BooleanFunctionNetDecorator::get_net_from(), hal::BooleanFunction::get_variable_names(), hal::BooleanFunction::Index(), test_multiple::netlist, OK, hal::BooleanFunction::Slice(), and hal::BooleanFunction::Var().

◆ substitute_power_ground_nets()

Result< BooleanFunction > hal::BooleanFunctionDecorator::substitute_power_ground_nets ( const Netlist nl) const

Substitute all Boolean function variables fed by power or ground gates by constant 0 and 1.

Parameters
[in]nl- The netlist to operate on.
Returns
The resulting Boolean function on success, an error otherwise.

Definition at line 16 of file boolean_function_decorator.cpp.

References hal::BooleanFunction::clone(), hal::BooleanFunction::Const(), ERR, hal::BooleanFunctionNetDecorator::get_net_from(), hal::BooleanFunction::get_variable_names(), hal::ground, net, OK, hal::power, and hal::BooleanFunction::substitute().

◆ substitute_power_ground_pins()

Result< BooleanFunction > hal::BooleanFunctionDecorator::substitute_power_ground_pins ( const Gate g) const

Substitute all Boolean function variables that belong to a pin connected to a power or ground gate by constant 0 and 1.

Parameters
[in]g- The gate which is connected to the pins and belongs to the Boolean function under inspection.
Returns
The resulting Boolean function on success, an error otherwise.

Definition at line 59 of file boolean_function_decorator.cpp.

References hal::BooleanFunction::clone(), hal::BooleanFunction::Const(), ERR, test_plugin::g, hal::BooleanFunction::get_variable_names(), hal::ground, net, OK, hal::power, and hal::BooleanFunction::substitute().


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