func_approx
is a utility that provides an approximation of f(x) for a given input data, x.
These are the templates to configure the function:
Parameters:
TT_DATA | Describes the type of individual data samples input to the function. This is a typename and must be one of the following:
|
TP_COARSE_BITS | Describes the number of bits in a sample of input data that will be used to address the provided lookup table. It determines the total number of locations in the lookup *table. |
TP_FINE_BITS | Describes the number of bits in an input data sample used for fine interpolation. |
TP_DOMAIN_MODE | Specifies a mode for the input domain of the chosen function for approximation. There are three modes available:
|
TP_WINDOW_VSIZE | Describes the number of samples to be processed in each call to this function. Configurations that are not supported by the lookup table API functions (all data types on AIE1, and int32 and float on AIE-ML) will require memory for two additional internal buffers of size TP_WINDOW_VSIZE. |
TP_SHIFT | Describes the number of bits to downshift the final output approximation. |
TP_RND | Describes the selection of rounding to be applied during the shift down stage of processing. Although TP_RND accepts unsigned integer values, descriptive macros are recommended:
|
TP_SAT | Describes the selection of saturation to be applied during the shift down stage of processing. TP_SAT accepts unsigned integer values, where:
|
template < typename TT_DATA, unsigned int TP_COARSE_BITS, unsigned int TP_FINE_BITS, unsigned int TP_DOMAIN_MODE, unsigned int TP_WINDOW_VSIZE, unsigned int TP_SHIFT, unsigned int TP_RND, unsigned int TP_SAT > class func_approx_graph: public graph // typedefs typedef std::conditional <std::is_same <TT_DATA, bfloat16>::value, float, TT_DATA>::type TT_LUT // fields port_array <input, 1> in port_array <output, 1> out kernel m_kernel[1] std::vector <TT_LUT> lut_ab std::vector <TT_LUT> lut_cd