06-19-2020 03:04 PM
I am implementing a Biquad filter in fixed point within the Xilinx system generator/Simulink environment! Coefficients of the filter are so small; I need to define the filter coefficients data types as (1,32,39) per say where I would keep one bit for the sign, and the LSB should represent (2^-39)! However, I am getting the following error (see the attached snapshot) from the Xilinx system generator that the binary point must be less than number of bits! Does anyone know how to define and implement such a data type in system generator? it is easy to implement it in matlab/fixed point data toolbox!
I'd appreciate any input!
06-22-2020 02:22 AM
This is an overflow condition, The guideline is applicable for Fixed point data, you will see the overflow error even in simulink during simulation if you set the binary points more than the total number of bits
Whenever you are setting the binary points, the value should be less than or equal to the total number of bits used for representing the data. In your example, the total number of bits 32 and you were trying to set binary points 39 which is out side of the range (32 bits)
If your requirements to have resolution 2^-39, please increase the total number of bits say 42 or 64 (greater than or equal to 39)
data types fix(1,32,39) is also not valid in simulink, you will see overflow error during simulation
I hope this will help you
06-22-2020 04:33 PM
I'd appreciate your prompt reply! I have tested data types in the format of say (1,32,39) in Matlab's fixed-point integer toolbox and it works flawlessly! As you pointed the precision is 2^-39 but since the range is small, we don't need to increase the number of integer bits! If I increase the number of bits to say 46 or so,I am not basically using the resources optimally! please advise
04-06-2021 10:19 AM
is there no other way than just waisting ressources? I agree with Hamid, we should have a way to define the binary point bigger than the number of bits