FIR filter generic

Z

Zorjak

Hi.
I am trying to write generic VHDL code for FIR filter. generic
parametars should be word_length, filter_order. Can anybody help me
how to input filter coeficients. I tought something like, read
coeficitients from file and write it in some LUT table. Could it be
done (or something similar)?

Thanks for help
 
J

Jiri Plasil

Zorjak napsal(a):
Hi.
I am trying to write generic VHDL code for FIR filter. generic
parametars should be word_length, filter_order. Can anybody help me
how to input filter coeficients. I tought something like, read
coeficitients from file and write it in some LUT table. Could it be
done (or something similar)?

Thanks for help
You can use e.g. std.textio.all package. The coeffs can be stored in the
regular text file. In case std.textio.all the content of the file is
binary string like

-- file.dat
0010000
0010001
....

--

(there is also possibility to use hex representation but different
package has to be used - from IEEE....)

Then just define ROM (distributed or block RAM) by array statement. E. g.
TYPE ROM IS ARRAY (N_COEFF - 1 DOWNTO 0) OF SIGNED(N_BITS - 1 DOWNTO 0);

Define function "init_function" to be able read data from file by means
of "readline" and "read" statement from textio package.

And finally initiate e. g. constant of coeffs.
CONSTANT coeff : ROM := init_function("file.dat");

It works in XST. I don't have any experience with Quartus. Check in the
Quartus documentation how is possible define initial value of registers
an memories.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top