Specify a fixed-point data type for a specialized function during fixed-point conversion. To learn more about function specialization, see Specializations (HDL Coder).
Open the function testFunc.
testFunc contains multiple calls to a subfunction tmpFunc with two different input types. Converting testFunc to fixed point creates fixed-point code with two specializations of tmpFunc. To generate fixed-point code for testFunc, create a fixed-point configuration object.
Generate fixed-point code.
fiaccel -float2fixed cfg testFunc;
Open the file testFunc_fixpt to view the generated fixed-point code. The two specializations of tmpFunc in testFunc_fixpt have distinct names, tmpFunc_s1 and tmpFunc_s2. The first specialization tmpFunc_s1 behaves differently between variables b and c, based on how the inputs are defined in tmpFunc.
To specify the data type assigned to only one specialization of tmpFunc, say tmpFunc_s2, add a data type to the fixed-point configuration object using addTypeSpecification.
Regenerate the fixed-point code.
fiaccel -float2fixed cfg testFunc;
Open testFunc_fixpt and observe the numeric type returned by the output of tmpFunc_s2.