04-14-2012 04:59 AM
I am implementing Gaussian Filter using FIR Compiler V 4.0. I want output of Gaussian Filter in bipolar form i.e (-1 to +1).
To implement Gaussian Filter I have generated the coefficients in MATLAB after that I have imported them in FIR Compliler.The specifications that I have used in the FIR Compiler are as given below :
SPECIFICATIONS OF Gaussian Filter in FIR COMPILER IP:
FILTER TYPE = DECIMATION
RATE CHANGE TYPE = INTEGER
DECIMATION RATE VALUE = 2
NO. OF CHANNELS = 1
INPUT SAMPLING FREQUENCY = 32 MHz
SYSTEM CLOCK = 32 MHz
FILTER ARCHEITECTURE = DISTRIBUTED ARITHMATIC
COEFF STRUCTURE = SYMMETRIC
COEFF TYPE = SIGNED
COEFF WIDTH = 16
INPUT DATA TYPE = SIGNED
INPUT DATA WIDTH = 8 ------(this is a 2's complement 8 bit scaled input i.e for 1 = "00000001" and for -1 = "11111111")
INPUT DATA FRAC BITS = 7
PASSBAND RANGE = 0.0 TO 0.1
STOPBAND RANGE = 0.1 TO 1.0
With this specifications I am not getting the output of Gaussian Filter in bipolar form. In which form should I give, input to the FIR Compiler to get the output of Gaussian filter in bipolar form?Please help me regarding this.
Solved! Go to Solution.
04-16-2012 12:40 AM
With this specifications I am not getting the output of Gaussian Filter in bipolar form.
What you are getting? Could you provide additional information (.xco, .coe, screenshots)?
In which form should I give, input to the FIR Compiler to get the output of Gaussian filter in bipolar form?Please help me regarding this.
Bipolar form just means that you interpret output samples as signed numbers.
Also perhaps, there is an error with truncation at output of the filter. What is output's bitwidth? Is it truncated?
What is your input signal? What you are expecting to get at output?
04-16-2012 02:02 AM
I want to know that for signed input what is the output of FIR Compiler signed or unsigned?
I have attached the .xco file of FIR filter. Please reply.
04-16-2012 02:14 AM
In attached .xco your coefficients are 16 bit signed and input data is 8 bit signed. So filter's output also is signed.
Input samples should be in range [-128=10000000b, 127=01111111b] in your case.
04-16-2012 04:05 AM
I tried to implemnt FIR filter by giving input as you mentioned i.e -128 to 127, but I am not getting the expected output i.e. Gaussian shaped pulse. Is there any problem in FIR output or generation of coefficient in MATLAB.
I have attached the .coe file
04-16-2012 05:13 AM
Your coefficient seem to be OK.
I tried to implemnt FIR filter by giving input as you mentioned i.e -128 to 127, but I am not getting the expected output i.e. Gaussian shaped pulse.
What is your input? Is it square wave? Or sine? Could you show your input, output and expected output waveforms?
You can try to feed signal with all zero samples except one sample equal to 127:
input=0, input=0, ..., input[K-1]=0, input[K]=127, input[K+1]=0, ...
Thus you should get at output attenuated gauss pulse (actually, scaled filter coefficients).
04-19-2012 04:52 AM
Thank you for your replies.
My input is a square wave and the input data width of fir filter is "8". Hence I am scaling my serial input to 8-bit (i.e. for 0 = "00000000" and for 1 = "11111111 ) And i am attaching u the screen shot of the input data to the filter and the expected output waveform. Now i am getting the expected output.
Please note that the DAC that i have used for observing the Gaussian shape is in bipolar configuration. Hence the screen shot waveform is in bipolar. Actually it is in unipolar which i have confirmed using simulation.
But one thing that is troubling now me is that when my coefficient is signed and when i am selecting input data type in fir compiler as unsigned only for this particular selection i am getting the required gaussian shape. And I dont have any justification for this i.e why only for input data type as "unsigned" I am getting the out put.
Please help regarding this.
04-19-2012 06:17 AM
Please follow Jim's advice and learn about fixed-point number representation.It will help you to deal with data interpretation in DSP systems.
Let me explain differences between signed and unsigned numbers.
Consider a case of 8-bit unsigned number:
11111111 (binary) = 255 (decimal) <- MAXIMUM value
11111110 (binary) = 254 (decimal)
10000001 (binary) = 129 (decimal)
10000000 (binary) = 128 (decimal) <- middle value
01111111 (binary) = 127 (decimal)
00000001 (binary) = 1 (decimal)
00000000 (binary) = 0 (decimal) <- MINIMUM value
If you choose 00000000 and 11111111 as two input values, then your signal is fullscale (in unsigned format).
Now lets have a look at 8-bit signed number representation:
01111111 (binary) = 127 (decimal) <- MAXIMUM value
01111110 (binary) = 126 (decimal)
00000010 (binary) = 2 (decimal)
00000001 (binary) = 1 (decimal)
00000000 (binary) = 0 (decimal) <- middle value
11111111 (binary) = -1 (decimal)
11111110 (binary) = -2 (decimal)
10000001 (binary) = -127 (decimal)
10000000 (binary) = -128 (decimal) <- MINIMUM value
So if you choose 00000000 and 11111111 as two input values in that case (signed), then your signal is almost zero. It explains why you can't see anything at output of the filter.
To get fullscale signal in signed representation you should choose 10000000 and 01111111 as input values.
04-20-2012 08:48 PM
First of all thanks for ur support. The problem has been resolved. The actual trouble was not in the signed or unsigned representation but we were failing to understand the simulated output waveform. But bcos of u we understood the concept well and only after that we understood the problem. Thank you once again.