Here our focus is on FIR digital filter, IIR filter not a practical filter so we left for discussion. For the experiment we are consider direct form, you can used any result will same, except power, area etc values.
Plan for the design
1] Generate the signal x1 and x2, mix x1+x2 as test signal for filter
2] Select the 20 tap filter, you can take according to your requirements, logic is that larger size will consume more re-sorceress like area and power.
3] Design the 20 tap filter using matlab script or fdatool, we are more interested in the coefficients only.
4] Validate the filter result using the matlab
5] Convert the coefficients of filter into either float or fix point, float will result into more area, as compare to fix point.
6] Build the direct form of filter structure using basic units [multiple, adder/ subs-tractor, register/ latches ]
———————————————————————————–
A] How direct form filter looks like ?
notation x(n) – input signal sequence h(k) – filter coefficient y(n)- filter output sequence
This filter is direct implementation of convolution formula
y = conv(x,h);
let say,
5 order filter is there so h(0)…h(4) coefficients will be there,
y(n) = h(0)x(n) + h(1)x(n-1) + h(2)x(n-2) + h(3)x(n-3) + h(4)x(n-4)
from this we can draw the structure of direct form filter.
B] Generating x1, x2 and mix x1+x2 test signal for filter
fs = 6e3;
t = (0:1/fs:0.1)';
fc = 400;
x1 = 10*sin(2*pi*fc*t)';
fc = 1600;
x2 = 10*sin(2*pi*fc*t)';
subplot(311)
plot(x1(1:200))
subplot(312)
plot(x2(1:200))
subplot(313)
plot(x1(1:200)+x2(1:200))
C] Script to design the 20 order filter using matlab or you can directly use fdatool from matlab to generate the script.
Before going in to the filter design [means generating the coefficients for the filter], there are few parameters need to look, like pass band , stop band and transition slop etc. To decide these values, lets first draw a frequency plot of the above signals for the idea.
So from the plot, to filter the x1 from the mix signal, pass band should be in between x1 and x2, so set it at 800Hz, next stop band can be set above 1000Hz.
so , script can be as
% All frequency values are in Hz.
Fs = 6000; % Sampling Frequency
N = 19; % Order
Fpass = 800; % Passband Frequency
Fstop = 1600; % Stopband Frequency
Wpass = 1; % Passband Weight
Wstop = 1; % Stopband Weight
dens = 20; % Density Factor
% Calculate the coefficients using the FIRPM function.
b = firpm(N, [0 Fpass Fstop Fs/2]/(Fs/2), [1 1 0 0], [Wpass Wstop],{dens});
Hd = dfilt.dffir(b);
coeff = Hd.Numerator;
After filter design with above specification and test on mix signal using simple commands
y3 = filter(b,1,x1+x2);
subplot(211);
plot(x1+x2);
subplot(212);
plot(y3);
filter output looks ok, now we can proceed for the rtl design steps.
D] Convert the h coefficient , x1+x2 into the hex values for the rtl design using following script, result is in t variable
h = b;
t = [];
for pnty=1:size(h,2)
t1 = [ 'assign h',num2str(pnty-1),' = 32''h' float2bin(h(pnty)) ';
t1 = t1(1:50);
t = [t ;t1];
end
similarly for the x1+x2 mix signals result is in t variable
xc = x1+x2;
t=[];
for pnty=1:size(xc,2)
t1 = [ float2bin(xc(pnty)) ];
t1 = [t1 ];
if size(t1,2) > 46
t1 = t1(1:46)
end
t=[t;t1];
end
The values in t is looks like below in hex form
00000000
4160338d
40ab464c
a7000000
4160338d
418a9067
27a00000
c0ab464c
40ab464c
using above code convert the coeff and mix signal into float hex values, that needs into rtl design of filter.
Main blocks of filter is adder, multiplier , latch but for floating point process, which may find one difficult to work with, any way,
this is the test setup for filter , we use coeff and mix signal values to force for simulation ,
This is the final result of filter which is the same of matlab result. hope you got it , design is using direct form of fir filter. For rtl code leave a comment will provide the same.
For any farther help or quires make comment below.
Thanks
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
My programmer is trying to convince me to move to .net from PHP.
I have always disliked the idea because of the costs.
But he’s tryiong none the less. I’ve been using Movable-type on several websites for about a year and am
concerned about switching to another platform. I have heard great things about blogengine.net.
Is there a way I can import all my wordpress posts into it?
Any kind of help would be really appreciated!
my web blog … vpn coupon code 2024
Fastidious answer back in return of this difficulty with real arguments
and describing the whole thing regarding that.
My homepage – vpn special
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
starzbet
Hello my loved one! I wish facebook vs eharmony to find love online
say that this article is amazing, great written and come with approximately all
important infos. I would like to look extra posts like this .
Hi there, of course this piece of writing is genuinely pleasant and I have learned lot
of things from it regarding blogging. thanks.
Also visit my web site; eharmony special coupon code 2024
Hello there, just became alert to your blog through Google, and found that it is really informative.
I am gonna watch out for brussels. I will appreciate if you continue this in future.
Many people will be benefited from your writing.
Cheers!
Feel free to surf to my website :: nordvpn special coupon code 2024
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://accounts.binance.com/sl/register?ref=PORL8W0Z
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.com/pt-BR/register-person?ref=YY80CKRN