FIR Filter Design
Structure:
Figure: FIR Filter structure
Steps:
Find coefficients:
I used Scilab for the same. Though, the procedure for the same is explained in Rulph Chassiang’s DSP book. The equation is mentioned in the book. I just expressed the equation in Scilab to get M coefficients.I followed the window's derivation method for finite response.
Above image depicts how to get the equation for the Fourier series.
v = normalized frequency = f / F (Nyq)
To compute the Fourier series coefficients for the filters:
Figure: Transfer function for the filters
So, for a LP filter:
v (normalized freq) = 0.2, coefficient calculation is shown.
And the derived signal could be convoluted in time domain with the base signal.
I derived the above, equation using Scilab and convoluted with Rectangular window function w(n):
Scilab script:
M =11
N =M-1;
U =N / 2;
h_Rect=window('re', M)
//hd(n) -> time domain function of Low Pass Filter
for n = 1:1:N+1
if (n-1) ==U
hd(n) =0.4;
else
hd( n) =( sin(2* %pi *( (n-1) - U ) /5) ) /( %pi *( (n-1) - U) ) ;
end
h( n ) = hd( n ) * h_Rect( n ) ;
end
H_f= fft(h)
H = abs(H_f)
plot(H)
//v (normalized freq) for Low Pass cut-off here is 0.4 (2/5)
Signal:
t = (0:0.5:10)
//signal with frequency peaks at 0.2 and 0.8 on normalized frequency scale
s_t = sin(2 * %pi * 0.2 * t) + sin(2 * %pi * 0.8 * t)
Filter output y(n) is calculated as:
M =11
s_t = {-1.225D-15, -1.1755705, -3.331D-16, -1.902113, 5.551D-16, -3.674D-16, 3.331D-16, 1.902113, -1.110D-16, 1.1755705, 1.00000004581D-18}
//latest sample is first. s_t(0) sample is the last element in the list
y = 0
for k = 1:1:M
y = y + (h(k) * s_t(k))
mat(1,k) = h(k) * s_t(k)
end
mat(1,12) = 0
for k=2:1:5
for m = 1:2:M
mat(k,(m+1)/2) = mat(k-1,m) + mat(k-1, m+1)
end
end
//y = output sample of that particular instance and mat represents the calculation of y at each step in rtl design.
RTL Design:
Once design is ready. You can start implementing the design using Hardware Description Language.
1. Study the IEEE Floating Point Number representation format.
2. Understand the basic arithmetic operations in Floating Point numbers.
3. Don't create unnecessary module hierarchies. Use functions/tasks to implement Floating Point arithmetic.
4. In the figure which represents the structure of the filter, visualize a flop or memory where a block with 'z' is placed. Every 'z' represents the sampled value at previous instance. Convolution is implemented over a time period.
Implementation:
After, RTL Design is ready, take the design through implementation flows including Synthesis, Scan Insertion and Physical Design.
Comments
Post a Comment