MATLAB: HDL Coder: how to divide (eg, 1/3) using simulink when the divisor is not 2^x

codecoderdividedivisiongenerationhdlHDL Coderoperatorsimulink

hello guys/girls,
how to perform the division of 1/3 in simulink for HDL code generation. I keep having the synthesis problem saying that the divisor need to be a value of 2^x .

Best Answer

Certain synthesis tools do not support division of arbitrary numbers; this is why you are encountering this restriction. The most straightforward way to generate a synthesizable division is to use the Product block in division mode by setting its inputs to '*/'. Then you can choose either the 'RecipNewton' or 'RecipNewtonSingleRate' implementation. These avoid the use of the '/' operator.