library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity filtro_fir is
port(clock,reset: in std_logic;
input: in std_logic_vector(15 downto 0);
output: out std_logic_vector(25 downto 0)
);
end filtro_fir;
architecture Structural of filtro_fir is
component shift
port(clock, reset: in std_logic;
input: in std_logic_vector(15 downto 0);
output: out std_logic_vector(15 downto 0)
);
end component;
component multipleier
port(input: in std_logic_vector(15 downto 0);
h: in std_logic_vector(9 downto 0);
output: out std_logic_vector(25 downto 0)
);
end component;
component adder
port(input_1,input_2: in std_logic_vector(25 downto 0);
output: out std_logic_vector(25 downto 0)
);
end component;
type h_vector is array(0 to 8) of std_logic_vector(9 downto 0);
signal h: h_vector := (
8 => "0000000100",
0 => "0000001011",
1 => "0000011111",
2 => "0000110100",
3 => "0000111101",
4 => "0000110100",
5 => "0000011111",
6 => "0000001011",
7 => "0000000100");
type segnale_1 is array(0 to 8) of std_logic_vector(15 downto 0);
signal s1: segnale_1;
type segnale_2 is array(0 to 8) of std_logic_vector(25 downto 0);
signal s2: segnale_2;
type segnale_3 is array(0 to 8) of std_logic_vector(25 downto 0);
signal s3: segnale_3;
begin
s1(0)<=input;
U0: multipleier port map(input=>s1(0),h=>h(8),output=>s3(0));
filter_gen: for i in 0 to 7 generate
U1:shift port map(clock=>clock,reset=>reset,input=>s1(i),output=>s1(i+1));
U2:multipleier port map(input=>s1(i+1),h=>h(i),output=>s2(i));
U3:adder port map(input_1=>s3(i),input_2=>s2(i),output=>s3(i+1));
end generate;
output<=s3(8);
end Structural;