#include "aie/func_approx_fns.hpp"
template < typename T_D, typename T_L > void xf::dsp::aie::func_approx::getInv ( T_L* lut_values, const int coarseBits, const int fineBits, const int domainMode, const int shift )
getInv is a utility function that will create a lookup table to be used for the approximation of the inverse of x. The recommended domainMode (TP_DOMAIN_MODE) for getInv is 2.
If domainMode = 1, where the input domain is 1 <= x < 2, it is expected that the most significant bit of coarseBits has been set to zero and will be ignored by the function approximation kernel when addressing the lookup table.
This means that the lookup table will be half the size of other domainMode (TP_DOMAIN_MODE) with a similar coarseBits value.
For domainMode values equal to 0 or 2, there are 2 ^ (coarseBits) locations, and when domainMode is equal to 1, there are 2 ^ (coarseBits - 1) locations.
Parameters:
T_D | Describes the type of data that will be input to the func_approx . |
T_L | Describes the type of the values stored in the lookup table. This should be equal to T_D unless T_D is bfloat16, in which case T_L should be float. |
lut_values | A pointer to the area where the lookup table of slope and offset values will be created. |
coarseBits | 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. |
fineBits | Describes the number of bits in an input data sample used for fine interpolation. It determines the width of each location. |
domainMode | The choice of TP_DOMAIN_MODE template parameter. This creates an approximation of f(x) where x is normalized over a specified domain. This can be:
|
shift | The downward shift value that will be applied to each offset of a location. This is only applicable to lookup tables with an integer type offset value. |