The mod block creates the functions, "div_s16_floor()" and "rt_modf_snf()", in model.c file. In general, CLA cannot access the function defined in a .c file. Currently, the mod block cannot be inside CLA due to the creation of two functions in the .c file.
CLA is a floating point processor unit where integer modulus operation is not supported.
For single modulus, you can make use of "CLAdiv()" function provided by TI and that is part of CLA math library function. This can be done in Simulink by using the following statement in a MATLAB function block:
function rem = fcn(num, den)
Quotient = int32(0);
if isequal(coder.target,'rtw')
Quotient = coder.ceval('CLAdiv',num,den);
rem = num - single(Quotient)*den;
else
rem = mod(num,den);
end
end
Note: CLAdiv will return the result of float type.
You can also refer to the example “c28035pmsmfoc_cla.slx” where a similar implementation of other CLA math library functions has been made. In the example, look inside the park transformation block in the following path c28035pmsmfoc_cla/FOC Algorithm/Torque Control Algorithm/Generating Space Vectors/Generating Raw Space Vectors/Park Transformation.