Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - info regarding digital low pass fir filter design in VHDL...

 
Thread Tools Search this Thread
Old 02-26-2004, 08:36 AM   #1
Default info regarding digital low pass fir filter design in VHDL...


hello...
As part of my final year project, iam working on digital low pass
FIR filter design in VHDL.
I have written the code for the filter design in VHDL.but, I have some
problem in debugging it.
I will be very thankful if you can debug it and send me back..
I worked on ALTERA MAX+PLUSII.
thanku...
Here,iam sending the code...

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity FIR_filter1 is port(
rst: in std_logic;
clk: in std_logic;
coef_ld: in std_logic;
start: in std_logic;
o_enable: in std_logic;
bypass: in std_logic;
Xn_in: in std_logic_vector(3 downto 0);

Yn_in: in std_logic_vector(15 downto 0);

Xn_out: out std_logic_vector(3 downto 0);

Yn_out: out std_logic_vector(15 downto 0)
);
end FIR_filter1;
architecture BEH of FIR_filter1 is
constant K: integer := 2;
-- circuit has four stages
-- use type and subtype to define the complex signals
subtype bit4 is std_logic_vector(3 downto 0);
subtype bit8 is std_logic_vector(7 downto 0);
subtype bit16 is std_logic_vector(15 downto 0);
type klx4 is array (K downto 0) of bit4;
type kx8 is array (K-1 downto 0) of bit8;
type klx8 is array (K downto 0) of bit8;
type kx16 is array (K-1 downto 0) of bit16;
type klx16 is array (K downto 0) of bit16;
-- define signal in type of arrays
signal REG1, REG2, COEF : klx4;
signal MULT8 : kx8;
signal MULT16 : kx16;
signal sumx : klx16;
signal Xn_tmp : bit4;
signal Yn_tmp : bit16;
begin
-- initialize the first stage of FIR circuit
REG2(K) <= Xn_in when (start='1')
else ("0000");
REG1(K) <= ("0000");
sumx(K) <= Yn_in;
COEF(K) <= Xn_in;
-- start the computation, use generate to obtain the
-- multiple stages
gen8: for j in K-1 downto 0 generate
stages: process (rst, clk)
begin
if (rst='0') then
REG1(j) <= ("0000");
REG2(j) <= ("0000");
COEF(j) <= ("0000");
MULT16(j) <= ("0000000000000000");
sumx(j) <= ("0000000000000000");
elsif (clk'event and clk ='1') then
REG1(j) <= REG2(j+1);
REG2(j) <= REG1(j);
if (coef_ld = '1') then
COEF(j) <= COEF(j+1);
end if;
MULT8(j) <= signed(REG1(j))*signed(COEF(j));
MULT16(j)(7 downto 0) <= MULT8(j);
if (MULT8(j)(7)='0') then
MULT16(j)(15 downto <= "00000000";
else MULT16(j)(15 downto <= "11111111";
end if;
sumx(j) <= signed(MULT16(j))+signed(sumx(j+1));
end if;
end process;
end generate;
-- control the outputs by concurrent statements
Xn_tmp <= Xn_in when bypass = '1' else
REG2(0) when coef_ld = '0'
else COEF(0);
Yn_tmp <= Yn_in when bypass = '1' else
sumx(0);
Xn_out <= Xn_tmp when o_enable = '0' else
(Xn_out'range => 'Z');
Yn_out <= Yn_tmp when o_enable = '0' else
(Yn_out'range => 'Z');
end BEH;


dhaanya nair
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Physical sythesis tool PALAC is not supported by Formal Verification tool Conf bbiandov Software 0 12-22-2008 05:25 AM
Help on auto conversion from Matlab to vhdl on filter design hardheart Hardware 0 12-07-2007 09:19 AM
Conformal LEC of a VHDL design (RTL Vs Netlist) sharatd Hardware 0 10-18-2006 02:47 PM
Criterion Goes Classic With Digital Vision DVNR. Allan DVD Video 2 04-18-2005 07:30 AM
Digital DIGEST - LIVE UPDATE Issue 38 Ablang DVD Video 0 11-09-2003 01:31 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46