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

Subversion Repositories cfft

[/] [cfft/] [tags/] [arelease/] [src/] [rofactor.vhd] - Blame information for rev 15

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

Line No. Rev Author Line
1 2 sradio
---------------------------------------------------------------------------------------------------
2
--
3
-- Title       : rofactor
4
-- Design      : cfft
5
-- Author      : ZHAO Ming
6
-- email           : sradio@opencores.org
7
--
8
---------------------------------------------------------------------------------------------------
9
--
10
-- File        : rofactor.vhd
11
-- Generated   : Thu Oct  3 00:12:16 2002
12
--
13
---------------------------------------------------------------------------------------------------
14
--
15
-- Description : Generate FFT rotation factor 
16
--
17
---------------------------------------------------------------------------------------------------
18
--
19
-- Revisions       :    0
20
-- Revision Number :    1
21
-- Version         :    1.1.0
22
-- Date            :    Oct 17 2002
23
-- Modifier        :    ZHAO Ming 
24
-- Desccription    :    Data width configurable 
25
--
26
---------------------------------------------------------------------------------------------------
27
--
28
-- Revisions       :    0
29
-- Revision Number :    2
30
-- Version         :    1.2.0
31
-- Date            :    Oct 18 2002
32
-- Modifier        :    ZHAO Ming 
33
-- Desccription    :    Data width configurable 
34
--
35
---------------------------------------------------------------------------------------------------
36
 
37
 
38
library IEEE;
39
use IEEE.STD_LOGIC_1164.all;
40
use ieee.std_logic_arith.all;
41
use ieee.std_logic_unsigned.all;
42
use ieee.std_logic_signed.all;
43
 
44
entity rofactor is
45
        generic (
46
                POINT : Natural;
47
                STAGE : Natural
48
        );
49
         port(
50
                 clk : in STD_LOGIC;
51
                 rst : in STD_LOGIC;
52
                 start : in STD_LOGIC;
53
                 inv : in std_logic;
54
--               step : in STD_LOGIC_VECTOR(2 downto 0);
55
                 angle : out STD_LOGIC_VECTOR(2*STAGE-1 downto 0)
56
             );
57
end rofactor;
58
 
59
 
60
architecture rofactor of rofactor is
61
signal counter : std_logic_vector( STAGE*2-1 downto 0 ):=( others=>'0' );
62
signal inc,iinc,phase : std_logic_vector( STAGE*2-1 downto 0 ):=( others=>'0' );
63
signal mask : std_logic_vector( STAGE*2-1 downto 0 ):=( others=>'0' );
64
begin
65
angle<=phase;
66
 
67
count:process( clk,rst )
68
begin
69
        if rst='1' then
70
                counter<=( others=>'0' );
71
                inc<=( others=>'0' );
72
                mask<=( others=>'0' );
73
        elsif clk'event and clk='1' then
74
                if start='1' then
75
                        counter<=( others=>'0' );
76
                        mask<=( others=>'0' );
77
--                      state<="000";
78
                        if inv='1' then
79
                                inc<=CONV_STD_LOGIC_VECTOR(1,STAGE*2);
80
                        else
81
                                inc<=CONV_STD_LOGIC_VECTOR(-1,STAGE*2);
82
                        end if;
83
                else
84
                        counter<=unsigned(counter)+1;
85
                        if signed(counter)=-1 then
86
                                inc<=inc(STAGE*2-3 downto 0 )&"00";
87
                                mask<="11"&mask( STAGE*2-1 downto 2 );
88
--                              if state/="100" then
89
--                                      state<=state+1;         
90
--                              end if;
91
                        end if;
92
                end if;
93
        end if;
94
end process count;
95
 
96
output : process( clk, rst )
97
begin
98
        if rst='1' then
99
                phase<=( others=>'0' );
100
                iinc<=( others=>'0' );
101
        elsif clk'event and clk='1' then
102
                if start='1' then
103
                        iinc<=( others=>'0' );
104
                        phase<=( others=>'0' );
105
                else
106
                        if unsigned(counter( 1 downto 0 ))=3 then
107
                                phase<=( others=>'0' );
108
                        else
109
                                phase<=unsigned(phase)+unsigned(iinc);
110
                        end if;
111
                        if signed(counter or mask)=-1 then
112
                                iinc<=(others=>'0');
113
                        elsif unsigned(counter( 1 downto 0 ))=3 then
114
                                iinc<=unsigned(iinc)+unsigned(inc);
115
                        end if;
116
                end if;
117
        end if;
118
end process output;
119
end rofactor;

powered by: WebSVN 2.1.0

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