Forum Discussion
Altera_Forum
Honored Contributor
17 years agoHi all,
First of all Kaz thank you very much. I have used excel to scale eight different sets of coeffs by your method 2). I now have filters all with the same gain. Perhaps it would help dtscindel if I told you how I managed to do it using the Altera fir compiler. In my system I have one low pass filter but with eight different cut-off frequencies and I wanted to get the same dc gain for each set of coefficients. I have 12 bit signed input. First I used the wizard and added eight sets of coefficients with the coefficient scaling set to auto with a bit width of 12. At this time the wizard told me that the ouput would be 30 bits wide. I then generated the filter. The generate process produced a .txt file called filename_coef_int.txt. This file contained the eight sets of coeffs in a form that I could then paste into excel. In excel I summed all eight sets of coeffs individually and got a different sum for each set. As Kaz says the gain of the filter is simply the sum of all the coeffs so to get the gains the same I realized I needed to get the sums the same. So in excel I inserted a new column for each set of coeffs. In this column I calculated a new set of scaled coefs by muliplying each unscaled coeff by the required new sum (in my case 16384) and dividing it by the original sum for that set of coeffs. ( as in Kazs method 2)). I then pasted each set of scaled coeffs into eight .txt files, one for each set. Finally I reopened the FIR compiler and imported each set of scaled coeffs, one by one, in the 'edit coeffs' window. All I had to do then was set the coeffs scaling bit width back to twelve and re generate the filter. Job done eight low pass filters all with the same gain and scaled to fit nicely in the 26 lower bits of the 30 bits the filter compiler allowed. I will probably drop off the lower 14 bits to give me back a twelve bit result. I hope this helps. Thanks again Kaz & FvM Cheers Dave