nkinar
Member level 2
I've designed a biquad IIR filter, and I would like to quantize the filter coefficients so that the difference equation can be used in a fixed-point FPGA code written in Verilog. The filter input ranges between 0 and ((2^12) -1) fixed-point values. The difference equation is Direct Form I (https://en.wikipedia.org/wiki/Digital_biquad_filter), and consists of additions, subtractions, and weighting values (coefficients).
The filter coefficients have been designed in Matlab as floating point values. How do I convert these floating point values to fixed-point that can be used in the Verilog code? Here is an example of the SOS matrix (https://www.mathworks.com/help/toolbox/signal/ref/sos2tf.html) with the filter coefficients.
Here are the filter coefficients in [a,b] format:
The [a,b] coefficients serve as the weights (https://en.wikipedia.org/wiki/Digital_biquad_filter), and the y is the output value.
The filter coefficients have been designed in Matlab as floating point values. How do I convert these floating point values to fixed-point that can be used in the Verilog code? Here is an example of the SOS matrix (https://www.mathworks.com/help/toolbox/signal/ref/sos2tf.html) with the filter coefficients.
Code:
1.0000 2.0302 1.0305 1.0000 -1.7596 0.7749
1.0000 2.0002 1.0005 1.0000 -1.8143 0.8301
1.0000 1.9696 0.9700 1.0000 -1.9175 0.9343
Here are the filter coefficients in [a,b] format:
Code:
a =
1.0000 -5.4914 12.5848 -15.4051 10.6225 -3.9118 0.6010
b =
1.0000 6.0000 15.0000 20.0000 15.0000 6.0000 1.0000
The [a,b] coefficients serve as the weights (https://en.wikipedia.org/wiki/Digital_biquad_filter), and the y is the output value.