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

Subversion Repositories cfft

[/] [cfft/] [trunk/] [src/] [cfft.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sradio
---------------------------------------------------------------------------------------------------
2
--
3
-- Title       : cfft
4
-- Design      : cfft
5
-- Author      : ZHAO Ming
6
-- email        : sradio@opencores.org
7
--
8
---------------------------------------------------------------------------------------------------
9
--
10
-- File        : cfft.vhd
11
-- Generated   : Thu Oct  3 03:03:58 2002
12
--
13
---------------------------------------------------------------------------------------------------
14
--
15
-- Description : 4-based 1024 point FFT input 12 bit Output 14 bit with 
16
--               limit and overfall processing internal
17
--
18
--              The gain is 0.0287 for FFT and 29.4 for IFFT
19
--
20
--                              The output is 4-based reversed ordered, it means
21
--                              a0a1a2a3a4a5a6a7a8a9 => a8a9a6a7a4a5aa2a3a0a1
22
--                              
23
--
24
---------------------------------------------------------------------------------------------------
25
 
26
 
27
---------------------------------------------------------------------------------------------------
28
--
29
-- port :
30
--                      clk : main clk          -- I have test 90M with Xilinx virtex600E
31
--          rst : globe reset   -- '1' for reset
32
--                      start : start fft       -- one clock '1' before data input
33
--                      inv : '0' for fft and '1' for ifft, it is sampled when start is '1' 
34
--                      Iin,Qin : data input-- following start immediately, input data
35
--                              -- power should not be too big
36
--          inputbusy : if it change to '0' then next fft is enable
37
--                      outdataen : when it is '1', the valid data is output
38
--          Iout,Qout : fft data output when outdataen is '1'                                                                      
39
--
40
---------------------------------------------------------------------------------------------------
41
--
42
-- Revisions       :    0
43
-- Revision Number :    1
44
-- Version         :    1.1.0
45
-- Date            :    Oct 17 2002
46
-- Modifier        :    ZHAO Ming 
47
-- Desccription    :    Data width configurable 
48
--
49
---------------------------------------------------------------------------------------------------
50
--
51
-- Revisions       :    0
52
-- Revision Number :    2
53
-- Version         :    1.2.0
54
-- Date            :    Oct 18 2002
55
-- Modifier        :    ZHAO Ming 
56
-- Desccription    :    Point configurable
57
--                      FFT Gain                IFFT GAIN
58
--                               256    0.0698                  17.9
59
--                              1024    0.0287                  29.4
60
--                              4096    0.0118                  48.2742
61
--                   
62
--
63
---------------------------------------------------------------------------------------------------
64
 
65
library IEEE;
66
use IEEE.STD_LOGIC_1164.all;
67
use IEEE.STD_LOGIC_ARITH.all;
68
 
69
entity cfft is
70
        generic (
71
                WIDTH : Natural;
72
                POINT : Natural;
73
                STAGE : Natural   -- STAGE=log4(POINT)
74
        );
75
         port(
76
                 clk : in STD_LOGIC;
77
                 rst : in STD_LOGIC;
78
                 start : in STD_LOGIC;
79
                 inv : in std_logic;
80
                 Iin : in STD_LOGIC_VECTOR(WIDTH-1 downto 0);
81
                 Qin : in STD_LOGIC_VECTOR(WIDTH-1 downto 0);
82
                 inputbusy : out STD_LOGIC;
83
                 outdataen : out STD_LOGIC;
84
                 Iout : out STD_LOGIC_VECTOR(WIDTH+1 downto 0);
85
                 Qout : out STD_LOGIC_VECTOR(WIDTH+1 downto 0)
86
             );
87
end cfft;
88
 
89
 
90
architecture cfft of cfft is
91
 
92
component address
93
        generic (
94
                WIDTH : Natural;
95
                POINT : Natural;
96
                STAGE : Natural
97
        );
98
         port(
99
                 clk : in STD_LOGIC;
100
                 rst : in STD_LOGIC;
101
                 start : in STD_LOGIC;
102
                 Iin : in std_logic_vector( WIDTH-1 downto 0 );
103
                 Qin : in std_logic_vector( WIDTH-1 downto 0 );
104
                 fftI : in std_logic_vector( WIDTH-1 downto 0 );
105
                 fftQ : in std_logic_vector( WIDTH-1 downto 0 );
106
                 wdataI : out std_logic_vector( WIDTH-1 downto 0 );
107
                 wdataQ : out std_logic_vector( WIDTH-1 downto 0 );
108
                 raddr : out STD_LOGIC_VECTOR(2*STAGE-1 downto 0);
109
                 waddr : out STD_LOGIC_VECTOR(2*STAGE-1 downto 0);
110
                 wen : out std_logic;
111
                 factorstart : out STD_LOGIC;
112
                 cfft4start : out STD_LOGIC;
113
                 outdataen : out std_logic;
114
                 inputbusy : out std_logic
115
             );
116
end component;
117
 
118
component blockdram
119
generic(
120
        depth:  integer;
121
        Dwidth: integer;
122
        Awidth: integer
123
);
124
port(
125
        addra: IN std_logic_VECTOR(Awidth-1 downto 0);
126
        clka: IN std_logic;
127
        addrb: IN std_logic_VECTOR(Awidth-1 downto 0);
128
        clkb: IN std_logic;
129
        dia: IN std_logic_VECTOR(Dwidth-1 downto 0);
130
        wea: IN std_logic;
131
        dob: OUT std_logic_VECTOR(Dwidth-1 downto 0));
132
end component;
133
 
134
component cfft4
135
        generic (
136
                WIDTH : Natural
137
        );
138
         port(
139
                 clk : in STD_LOGIC;
140
                 rst : in STD_LOGIC;
141
                 start : in STD_LOGIC;
142
                 inv : in std_logic;
143
                 I : in STD_LOGIC_VECTOR(WIDTH-1 downto 0);
144
                 Q : in STD_LOGIC_VECTOR(WIDTH-1 downto 0);
145
                 Iout : out STD_LOGIC_VECTOR(WIDTH+1 downto 0);
146
                 Qout : out STD_LOGIC_VECTOR(WIDTH+1 downto 0)
147
             );
148
end component;
149
 
150
component div4limit
151
        generic (
152
                WIDTH : Natural
153
        );
154
        port(
155
                clk : in std_logic;
156
                 D : in STD_LOGIC_VECTOR(WIDTH+3 downto 0);
157
                 Q : out STD_LOGIC_VECTOR(WIDTH-1 downto 0)
158
             );
159
end component;
160
 
161
component mulfactor
162
        generic (
163
                WIDTH : Natural;
164
                STAGE : Natural
165
        );
166
         port(
167
                 clk : in STD_LOGIC;
168
                 rst : in STD_LOGIC;
169
                 angle : in signed(2*STAGE-1 downto 0);
170
                 I : in signed(WIDTH+1 downto 0);
171
                 Q : in signed(WIDTH+1 downto 0);
172
                 Iout : out signed(WIDTH+3 downto 0);
173
                 Qout : out signed(WIDTH+3 downto 0)
174
             );
175
end component;
176
 
177
component rofactor
178
        generic (
179
                POINT : Natural;
180
                STAGE : Natural
181
        );
182
         port(
183
                 clk : in STD_LOGIC;
184
                 rst : in STD_LOGIC;
185
                 start : in STD_LOGIC;
186
                 inv : in std_logic;
187
                 angle : out STD_LOGIC_VECTOR(2*STAGE-1 downto 0)
188
             );
189
end component;
190
signal wea,cfft4start,factorstart:std_logic:='0';
191
signal wdataI,wdataQ,fftI,fftQ,Iramout,Qramout:std_logic_vector(WIDTH-1 downto 0):=(others=>'0');
192
signal waddr,raddr:std_logic_vector( 2*STAGE-1 downto 0):=(others=>'0');
193
signal Icfft4out,Qcfft4out:std_logic_vector( WIDTH+1 downto 0):=(others=>'0');
194
signal angle:std_logic_vector( 2*STAGE-1 downto 0 ):=( others=>'0');
195
signal Imulout,Qmulout:signed( WIDTH+3 downto 0):=(others=>'0');
196
signal inv_reg:std_logic:='0';
197
 
198
begin
199
 
200
Aaddress:address
201
generic map (
202
        WIDTH=>WIDTH,
203
        POINT=>POINT,
204
        STAGE=>STAGE
205
)
206
port map (
207
        clk=>clk,
208
        rst=>rst,
209
        start=>start,
210
        Iin=>Iin,
211
        Qin=>Qin,
212
        fftI=>fftI,
213
        fftQ=>fftQ,
214
        wdataI=>wdataI,
215
        wdataQ=>wdataQ,
216
        raddr=>raddr,
217
        waddr=>waddr,
218
        wen=>wea,
219
        factorstart=>factorstart,
220
        cfft4start=>cfft4start,
221
        outdataen=>outdataen,
222
        inputbusy=>inputbusy
223
             );
224
 
225
Iram:blockdram
226
generic map (
227
        depth=>POINT,
228
        Dwidth=>WIDTH,
229
        Awidth=>2*STAGE
230
)
231
port map (
232
        addra=>waddr,
233
        clka=>clk,
234
        addrb=>raddr,
235
        clkb=>clk,
236
        dia=>wdataI,
237
        wea=>wea,
238
        dob=>Iramout
239
);
240
 
241
Qram:blockdram
242
generic map (
243
        depth=>POINT,
244
        Dwidth=>WIDTH,
245
        Awidth=>2*STAGE
246
)
247
port map (
248
        addra=>waddr,
249
        clka=>clk,
250
        addrb=>raddr,
251
        clkb=>clk,
252
        dia=>wdataQ,
253
        wea=>wea,
254
        dob=>Qramout
255
);
256
 
257
acfft4:cfft4
258
generic map (
259
        WIDTH=>WIDTH
260
)
261
port map (
262
        clk=>clk,
263
        rst=>rst,
264
        start=>cfft4start,
265
        inv=>inv_reg,
266
        I=>Iramout,
267
        Q=>Qramout,
268
        Iout=>Icfft4out,
269
        Qout=>Qcfft4out
270
             );
271
 
272
Iout<=Icfft4out;
273
Qout<=Qcfft4out;
274
 
275
Ilimit:div4limit
276
generic map (
277
        WIDTH=>WIDTH
278
)
279
port map (
280
        clk=>clk,
281
        D=>std_logic_vector(Imulout),
282
        Q=>fftI
283
             );
284
Qlimit:div4limit
285
generic map (
286
        WIDTH=>WIDTH
287
)
288
port map (
289
        clk=>clk,
290
        D=>std_logic_vector(Qmulout),
291
        Q=>fftQ
292
             );
293
 
294
amulfactor:mulfactor
295
generic map (
296
        WIDTH=>WIDTH,
297
        STAGE=>STAGE
298
)
299
port map (
300
        clk=>clk,
301
        rst=>rst,
302
        angle=>signed(angle),
303
        I=>signed(Icfft4out),
304
        Q=>signed(Qcfft4out),
305
        Iout=>Imulout,
306
        Qout=>Qmulout
307
             );
308
 
309
arofactor:rofactor
310
generic map (
311
        POINT=>POINT,
312
        STAGE=>STAGE
313
)
314
port map (
315
        clk=>clk,
316
        rst=>rst,
317
        start=>factorstart,
318
        inv=>inv_reg,
319
        angle=>angle
320
             );
321
 
322
process( clk, rst )
323
begin
324
        if rst='1' then
325
                inv_reg<='0';
326
        elsif clk'event and clk='1' then
327
                if start='1' then
328
                        inv_reg<=inv;
329
                end if;
330
        end if;
331
end process;
332
 
333
 
334
 
335
end cfft;

powered by: WebSVN 2.1.0

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