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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [vhdl/] [WISHBONE_FIR/] [interface_slave_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
entity interface_slave_fir is
6
generic(
7
 
8
data_wordwidth: integer;
9
adress_wordwidth: integer;
10
Adr_bas:integer;
11
reg_control:integer;
12
reg_data:integer;
13
reg_status:integer;
14
reg_Q:integer;
15
reg_coef:integer;
16
 
17
N_coef:integer;
18
 
19
M:integer;
20
WordWidth_Q:integer--width signal of Q
21
 
22
);
23
port(
24
 
25
 
26
 ACK_O: out   std_logic;--to MASTER
27
 ADR_I: in    std_logic_vector( adress_wordwidth-1 downto 0 );
28
 DAT_I: in    std_logic_vector( data_wordwidth-1 downto 0 );--from MASTER
29
 sDAT_I: in    std_logic_vector( data_wordwidth-1 downto 0 );--from SLAVE
30
 DAT_O: out   std_logic_vector( data_wordwidth-1 downto 0 );--to MASTER
31
 sDAT_O: out   std_logic_vector( data_wordwidth-1 downto 0 );--to SLAVE
32
 STB_I: in    std_logic;--from MASTER
33
 WE_I: in    std_logic;--from MASTER
34
 Start: out    std_logic;--to SLAVE     
35
 h0: out std_logic_vector( (N_coef*M)-1 downto 0 );--to SLAVE
36
 Q :out std_logic_vector(WordWidth_Q-1 downto 0);
37
 clear,reset,clk: in std_logic
38
 
39
 );
40
end entity;
41
 
42
architecture RTL of interface_slave_fir is
43
 
44
--The fullregister component
45
component fullregister is
46
 
47
        generic
48
        (
49
                N: integer
50
        );
51
 
52
        port
53
        (
54
                clk               : in std_logic;
55
                reset_n   : in std_logic;
56
                enable    : in std_logic;
57
                clear             : in std_logic;
58
                d                 : in std_logic_vector(N-1 downto 0);
59
                q                 : out std_logic_vector(N-1 downto 0)
60
 
61
        );
62
end component;
63
 
64
signal OUT_AUX,rSTATUS_O, ZERO:  std_logic_vector( data_wordwidth-1 downto 0 );
65
signal ZERO1:  std_logic_vector( WordWidth_Q-1 downto 0 );
66
 
67
type array_aux is array(N_coef downto 0) of std_logic_vector(M-1 downto 0);
68
signal h0_aux:array_aux;
69
 
70
type array_aux1 is array(N_coef downto 0) of std_logic;
71
signal enables:array_aux1;
72
 
73
begin
74
        ZERO<=std_logic_vector(to_unsigned(0,data_wordwidth));
75
        ZERO1<=std_logic_vector(to_unsigned(0,WordWidth_Q));
76
        OUT_AUX<=DAT_I;
77
        ACK_O<=STB_I;
78
 
79
 
80
        DAT_O<=sDAT_I;
81
 
82
        coefficients:
83
                        for k in N_coef-1 downto 0 generate
84
 
85
                                 enables(k)<='1' when (STB_I='1' and  WE_I='1' and ADR_I(9 downto 0)=std_logic_vector(to_unsigned((4*k)+reg_coef,10))) else
86
                                                                        '0';
87
 
88
                                                coefs:fullregister
89
                                                        generic map(
90
                                                                                        N=>M
91
                                                                                        )
92
                                                        port map (
93
                                                                                        clk=>clk,
94
                                                                                        reset_n=>reset,
95
                                                                                        enable=>enables(k),
96
                                                                                        clear=>clear,
97
                                                                                        d=>OUT_AUX(M-1 downto 0),
98
                                                                                        q=>h0_aux(k)
99
                                                                                        );
100
                                                        h0((k+1)*M-1 downto k*M)<=std_logic_vector(signed(h0_aux(k)));
101
 
102
                        end generate;
103
 
104
 
105
 
106
        process(ADR_I,STB_I,WE_I,ZERO,ZERO1,OUT_AUX,sDAT_I,rSTATUS_O)
107
        begin
108
 
109
                                --if ((ADR_I(adress_wordwidth-1 downto adress_wordwidth-4))=std_logic_vector(to_unsigned(Adr_bas,4))) then 
110
                                 if (WE_I='1' and STB_I='1') then
111
                                                case ADR_I(9 downto 0) is
112
 
113
                                                                when std_logic_vector(to_unsigned(reg_control,10)) => start<='1';
114
                                                                                                                                                                                                                                                        --sDAT_O<=ZERO;
115
                                                                                                                                                                                                                                                        --DAT_O<=ZERO;
116
                                                                                                                                                                                                                                                        rSTATUS_O<=ZERO;
117
                                                                                                                                                                                                                                                        --Q<=ZERO1;
118
 
119
 
120
                                                                when std_logic_vector(to_unsigned(Reg_status,10)) => rSTATUS_O<=std_logic_vector(unsigned(OUT_AUX));
121
                                                                                                                                                                                                                                                  --sDAT_O<=ZERO;
122
                                                                                                                                                                                                                                                 -- DAT_O<=ZERO;
123
                                                                                                                                                                                                                                                  start<='0';
124
                                                                                                                                                                                                                                                  --Q<=ZERO1;
125
 
126
 
127
                                                                when OTHERS => --DAT_O<=ZERO;
128
                                                                                                        --sDAT_O<=ZERO;
129
                                                                                                        start<='0';
130
                                                                                                        rSTATUS_O<=ZERO;
131
                                                                                                        --Q<=ZERO1;
132
                                                 end case;
133
--                               elsif (WE_I='0' and STB_I='1') then
134
--                                              case ADR_I(4 downto 0) is 
135
--                                                              when std_logic_vector(to_unsigned(reg_data,5)) => DAT_O<=sDAT_I;
136
--                                                                                                                                                                                                                                              --sDAT_O<=ZERO;
137
--                                                                                                                                                                                                                                              start<='0';     
138
--                                                                                                                                                                                                                                              rSTATUS_O<=ZERO;        
139
--                                                                                                                                                                                                                                              ---Q<=ZERO1;
140
--
141
--                                                              when std_logic_vector(to_unsigned(Reg_status,5)) => DAT_O<=rSTATUS_O;
142
--                                                                                                                                                                                                                                                --sDAT_O<=ZERO;
143
--                                                                                                                                                                                                                                                start<='0';
144
--                                                                                                                                                                                                                                                rSTATUS_O<=ZERO; 
145
--                                                                                                                                                                                                                                                --Q<=ZERO1;
146
--                                                              when OTHERS => DAT_O<=ZERO;
147
--                                                                                                      --sDAT_O<=ZERO;
148
--                                                                                                      start<='0';
149
--                                                                                                      rSTATUS_O<=ZERO;
150
--                                                                                                      --Q<=ZERO1;
151
--                                               end case;
152
 
153
                                        --end if; 
154
                                 else
155
                                        --      DAT_O<=ZERO;
156
                                                --sDAT_O<=ZERO;
157
                                                start<='0';
158
                                                rSTATUS_O<=ZERO;
159
                                                --Q<=ZERO1;
160
                                 end if;
161
 
162
        end process;
163
 
164
        process(ADR_I,STB_I,WE_I,ZERO,ZERO1,OUT_AUX,sDAT_I,rSTATUS_O)
165
        begin
166
         if rising_edge(clk) then
167
 
168
                                 if (WE_I='1' and STB_I='1') then
169
                                                if ADR_I(9 downto 0)=std_logic_vector(to_unsigned(reg_data,10)) then
170
 
171
 
172
                                                                 sDAT_O<=OUT_AUX;
173
                                                end if;
174
                                                if ADR_I(9 downto 0)=std_logic_vector(to_unsigned(reg_Q,10)) then
175
 
176
 
177
                                                                 --Q<=OUT_AUX(data_wordwidth-1 downto data_wordwidth-WordWidth_Q);
178
                                                                 Q<=OUT_AUX(WordWidth_Q-1 downto 0);
179
                                                end if;
180
 
181
 
182
 
183
 
184
 
185
                                 end if;
186
                        end if;
187
 
188
 
189
        end process;
190
end architecture;
191
 
192
 
193
 

powered by: WebSVN 2.1.0

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