OpenCores
URL https://opencores.org/ocsvn/wdsp/wdsp/trunk

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [vhdl/] [WISHBONE_FIR/] [FILTER_FIR.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
 
5
--use work.coeff_pkg.all;
6
 
7
entity FILTER_FIR is
8
generic (WordWidth:integer;--width signal of in/out
9
                        N_coef:integer;--coefs 
10
                        M:integer;--width word of coefs
11
                        WordWidth_Q:integer;--width signal of Q
12
                        bit_growth:integer:=8
13
                        );
14
 
15
port(
16
signal_input: in std_logic_vector(WordWidth-1 downto 0);
17
signal_output:out std_logic_vector(WordWidth+bit_growth-1 downto 0);
18
filter_coef: in std_logic_vector(M*N_coef-1 downto 0);
19
enable,clear,reset,clk: in std_logic;
20
Q :in std_logic_vector(WordWidth_Q-1 downto 0)
21
 
22
);
23
end entity;
24
 
25
architecture RTL of FILTER_FIR is
26
 
27
--The cell mult and sum
28
component cell is
29
generic (WordWidth:integer;--width signal of in/out
30
                        M:integer;--width word of coefs
31
                        WordWidth_Q:integer--width signal of Q
32
 
33
                        );
34
 
35
port(
36
 
37
signal_input :in std_logic_vector(WordWidth-1 downto 0);
38
filter_coef: in std_logic_vector(M-1 downto 0);
39
reg_input:in std_logic_vector(WordWidth-1 downto 0);
40
signal_output:out std_logic_vector(WordWidth-1 downto 0);
41
clk,reset,clear,enable:in std_logic;
42
Q :in std_logic_vector(WordWidth_Q-1 downto 0)
43
 
44
);
45
end component;
46
 
47
type array_aux is array(N_coef downto 0) of std_logic_vector(WordWidth+bit_growth-1 downto 0);
48
signal cell_aux: array_aux;
49
signal sext:std_logic_vector(bit_growth-1 downto 0);
50
begin
51
sext<=(others=>signal_input(WordWidth-1));
52
myfilter:
53
        for k in N_coef-1 downto 0 generate
54
filter:cell
55
                generic map(
56
                                                WordWidth=>WordWidth+bit_growth,
57
                                                M=>M,
58
                                                WordWidth_Q=>WordWidth_Q
59
 
60
                                                )
61
 
62
                port map(
63
                                        signal_input=>sext&signal_input,
64
                                        signal_output=>cell_aux(k),
65
                                        filter_coef=>filter_coef((k+1)*M-1 downto k*M),
66
                                        reg_input=>cell_aux(k+1),
67
                                        enable=>enable,
68
                                        clk=>clk,
69
                                        reset=>reset,
70
                                        clear=>clear,
71
                                        Q=>Q
72
 
73
                                        );
74
                signal_output<=cell_aux(0)(WordWidth+bit_growth-1 downto 0);
75
        end generate;
76
 
77
end architecture;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.