Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Digital Filter Implementation on FPGA

Status
Not open for further replies.

prakhars

Junior Member level 3
Joined
Oct 5, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,497
I have generated Sine Wave of 10kHz using verilog HDL and verified It on ModelSIm.

I also have generated Verilog HDL code of BPF around 10kHz on Matlab but I am not able to verify it. I am getting some arbitrary wave at the output of filter in Modelsim.

I want to know how a digital filter treats input Digital SIgnal??? Is it the difference between amplitude of two consecutive samples that decides frequency or what?? and also How to resolve my Sine Wave Filter Issue.

Thanks in Advance :)
 

Hi,

Your post is confusing.

If you generate a 10kHz sine, then you should know that 'amplitude' and 'frequency' are two independent values.

If you built a filter into an FPGA, then you need to know a lot of information on the filter:
* filter input data format (serial, parallel, bit width...)
* filter data rate (sampling rate, maybe oversampling rate...)
* filter type (FIR, IIR, biquad...)
* filter cutoff frequencies
* filter characteristic (butterworth, bessel, elliptic...)

If you want to verify a filter (or any other system) then you first need to know how it works.
You should know how the output should look like when your input is a known signal.

Maybe you could draw a diagram how it should work...and how you tried to implement it.
..and where exactely you come to a problem

Klaus
 

Thanks for reply Klaus.

I am working on a FPGA based FSK system. To my system, coming a Sine Wave of either 10kHz, 20kHz or 30kHz. I am converting it to digital using ADC and then I want to pass it through FIR filter to pass only 10kHz sine wave.

Actually why I related amplitude and frequency in my post above is because a sudden change in amplitude signifies presence of high frequency component. This thing is quite easy to understand in analog domain, but in digital domain problem arises.

SO my objective is to receive input sine wave, pass it to a filter. Filter will give output of 10kHz sine wave only when input is 10kHz otherwise output is zero.
 

Hi,

Actually why I related amplitude and frequency in my post above is because a sudden change in amplitude signifies presence of high frequency component. This thing is quite easy to understand in analog domain, but in digital domain problem arises.
This is the same in analog and digital.

If you change the amplitude you always generate additional frequency components. It is like amplitude modulation. You should find documentation about AM including detailed description about the resulting frequency sidebands.

***

If you compare the output of an anlog filter with the output of a digital filter (of identical characteristic) you will get the same result.
(But with a FIR filter it will not be possible to create the same filter characteristic as with an analog filter. If you want the same characteristic you should go for IIR fiter or biquad)

***
Filter will give output of 10kHz sine wave only when input is 10kHz otherwise output is zero.
Because of noise your filter output is unlikely to be zero. Expect it always to be positve and negative, because the output signal will be 10kHz AC.
Expect a minimal AC output signal, in either case. Therefore you need to calculate the amplitude of the signal (DFT, FFT, RMS, average of rectified...) and compare this amplitude_signal with your desired threshold(s).

***
My recommendation:
Read about digital processing of FSK.
(A similar task is to digitally decode a DTMF signal, so you can read through it and find out if this helps you).

How i´d implement it: Instead of filtering (FIR, BPF) perform a single frequency 10kHz DFT. You well get a complex vector that easily can be calculated as amplitude.

Klaus
 
I have generated Sine Wave of 10kHz using verilog HDL and verified It on ModelSIm.

I also have generated Verilog HDL code of BPF around 10kHz on Matlab but I am not able to verify it. I am getting some arbitrary wave at the output of filter in Modelsim.
This could be an issue with overflow or numeric issues, or a lack of understanding of the filter. My advice is to run a simulation with a single impulse -- the should give a predictable output (the impulse response). For FIR filters, you should also send in the worst-case input -- a set of +1/-1 corresponding to the filter coefficients. This shows overflow issues with FIR filters. IIR filters have more issues and more implementation issues.

I want to know how a digital filter treats input Digital SIgnal??? Is it the difference between amplitude of two consecutive samples that decides frequency or what?? and also How to resolve my Sine Wave Filter Issue.

"Frequency" is normalized to the sampling rate. Basically, if your sampling rate is 40khz, then 10khz is fs/4. Frequency is limited to +-fs/2. This is different from continuous time where frequency is not limited. This all means that a filter for a specific frequency requires you to know the sample rate. Similar to continuous time, any shape that is not a sine wave will contain multiple frequencies.
 

maybe it's something to do with overflow? you could define your QM.N format in matlab and simulate it beforehand to avoid overflow.
 

Having a Matlab+System Generator model will be of very much helpful for your case. However, I hope you have Matlab. Since you have asked to design a filter to remove all frequency components post 10KHz for an FSK, I hope you need a low pass filter and not a BPF. Plus BPF consumes more resources as well. Open simulink, open fda tool or digital filter box and add to a design. Now set the tap number and your filter type, cut off range, weight if any. Check filter response. Now copy that co-eff and put it on your filter design tool if you are using FPGA IP. FPGA vendors provide filter response tool along with FIR compiler IP. Both Matlab and your IP output wave (magnitude vs frequency) should look same.

Just as others said, if your filter works as expected, you can set a threshold and decode 0 and 1 easily. Of course there could be some variation in duty cycle of the decoded data, which can be digitally corrected. Matlab is your only hold
 

I guess you need to apply smoothing filter before any other filter, because there will be lot of distortion in signal due to abrupt changes created by DAC. I guess you are working on direct digital synthesis.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top