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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [vhdl/] [WISHBONE_FIR/] [FIR_WB.vhd] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
library ieee;
2
library work;
3
--use work.coeff_pkg.all;
4
use ieee.std_logic_1164.all;
5
use ieee.numeric_std.all;
6
 
7
 
8
entity FIR_WB is
9
generic (Filter_Width:integer:=16;--Filter width signals of in/out
10
                        WB_Width:integer:=32;--WishBone width signal of in/out
11
                        N_coef:integer:=50;--coefs 
12
                        M:integer:=16;--width word of coefs
13
                        WordWidth_Q:integer:=4;--width signal of Q
14
                        bit_growth:integer:=8;
15
                        adress_wordwidth:integer:=32 ;
16
                        Adr_bas:integer:=8;
17
                        reg_control:integer:=4;
18
                        reg_data:integer:=8;
19
                        reg_status:integer:=12;
20
                        reg_Q:integer:=16;
21
                        reg_coef:integer:=20
22
 
23
                        );
24
 
25
port(
26
DAT_I: in std_logic_vector(WB_Width-1 downto 0);
27
DAT_O:out std_logic_vector(WB_Width-1 downto 0);
28
ADR_I :in std_logic_vector(adress_wordwidth-1 downto 0);
29
STB_I,RST_I,CLK_I,WE_I,clear: in std_logic;
30
ACK_O: out   std_logic
31
);
32
end entity;
33
 
34
 
35
architecture RTL of FIR_WB is
36
 
37
component FILTER_FIR is
38
generic (WordWidth:integer;--width signal of in/out
39
                        N_coef:integer;--coefs 
40
                        M:integer;--width word of coefs
41
                        WordWidth_Q:integer;--width signal of Q
42
                        bit_growth:integer
43
 
44
 
45
                        );
46
 
47
port(
48
signal_input: in std_logic_vector(WordWidth-1 downto 0);
49
signal_output:out std_logic_vector(WordWidth+bit_growth-1 downto 0);
50
filter_coef: in std_logic_vector(M*N_coef-1 downto 0);
51
enable,clear,reset,clk: in std_logic;
52
Q :in std_logic_vector(WordWidth_Q-1 downto 0)
53
 
54
);
55
end component;
56
 
57
component interface_slave_fir is
58
generic(
59
 
60
data_wordwidth: integer;
61
adress_wordwidth: integer;
62
Adr_bas:integer;
63
reg_control:integer;
64
reg_data:integer;
65
reg_status:integer;
66
reg_Q:integer;
67
reg_coef:integer;
68
N_coef:integer;
69
M:integer;
70
WordWidth_Q:integer
71
);
72
port(
73
 
74
 
75
 ACK_O: out   std_logic;--to MASTER
76
 ADR_I: in    std_logic_vector( adress_wordwidth-1 downto 0 );
77
 DAT_I: in    std_logic_vector( data_wordwidth-1 downto 0 );--from MASTER
78
 sDAT_I: in    std_logic_vector( data_wordwidth-1 downto 0 );--from SLAVE
79
 DAT_O: out   std_logic_vector( data_wordwidth-1 downto 0 );--to MASTER
80
 sDAT_O: out   std_logic_vector( data_wordwidth-1 downto 0 );--to SLAVE
81
 STB_I: in    std_logic;--from MASTER
82
 WE_I: in    std_logic;--from MASTER
83
 Start: out    std_logic;--to SLAVE     
84
 h0: out std_logic_vector( (N_coef*M)-1 downto 0 );
85
 Q: out std_logic_vector( WordWidth_Q-1 downto 0 );
86
 clear,reset,clk: in std_logic
87
 );
88
end component;
89
 
90
signal h0_aux:std_logic_vector(M*N_coef-1 downto 0);
91
signal fir_data_in:std_logic_vector(WB_Width-1 downto 0);
92
signal fir_data_out:std_logic_vector(Filter_Width+bit_growth-1 downto 0);
93
signal Q_aux:std_logic_vector(WordWidth_Q-1 downto 0);
94
signal Start_aux, WE_O_aux:std_logic;
95
signal sext:std_logic_vector(bit_growth-1 downto 0);
96
begin
97
 
98
sext<=(others=>fir_data_out(Filter_Width+bit_growth-1));
99
 
100
myFilter:FILTER_FIR
101
generic map(
102
                        WordWidth=>Filter_Width,
103
                        N_coef=>N_coef,
104
                        M=>M,
105
                        WordWidth_Q=>WordWidth_Q,
106
                        bit_growth=>bit_growth
107
)
108
        port map (
109
                signal_input=>fir_data_in(Filter_Width-1 downto 0),
110
                signal_output=>fir_data_out,
111
                filter_coef=>h0_aux,
112
                enable=>Start_aux,
113
                clear=>clear,
114
                reset=>RST_I,
115
                clk=>CLK_I,
116
                Q=>Q_aux
117
                );
118
 
119
wb_interface:interface_slave_fir
120
generic map(
121
 
122
data_wordwidth=>WB_Width,
123
adress_wordwidth=>adress_wordwidth,
124
Adr_bas=>Adr_bas,
125
reg_control=>reg_control,
126
reg_data=>reg_data,
127
reg_status=>reg_status,
128
reg_Q=>reg_Q,
129
reg_coef=>reg_coef,
130
N_coef=>N_coef,
131
M=>M,
132
WordWidth_Q=>WordWidth_Q
133
 
134
)
135
port map(
136
 
137
 
138
 ACK_O=>ACK_O,
139
 ADR_I=>ADR_I,
140
 DAT_I=>DAT_I,
141
 sDAT_I=>sext&fir_data_out,
142
 DAT_O=>DAT_O,
143
 sDAT_O=>fir_data_in,
144
 STB_I=>STB_I,
145
 WE_I=>WE_I,
146
 Start=>Start_aux,
147
 h0=>h0_aux,
148
 Q=>Q_aux,
149
 clear=>clear,
150
 reset=>RST_I,
151
 clk=>CLK_I
152
 );
153
 
154
end architecture;

powered by: WebSVN 2.1.0

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