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

Subversion Repositories cordic

[/] [cordic/] [trunk/] [polar2rect/] [p2r_cordic.vhd] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 rherveille
--
2
--      VHDL implementation of cordic algorithm
3
--
4
-- File: p2r_cordic.vhd
5
-- author: Richard Herveille
6
-- rev. 1.0 initial release
7
--
8
 
9
library ieee;
10
use ieee.std_logic_1164.all;
11
use ieee.std_logic_arith.all;
12
 
13
entity p2r_cordic is
14
        generic(
15
                PIPELINE : integer := 15;
16
                WIDTH    : integer := 16);
17
        port(
18
                clk     : in std_logic;
19
                ena : in std_logic;
20
 
21
                Xi      : in signed(WIDTH -1 downto 0);
22
                Yi : in signed(WIDTH -1 downto 0) := (others => '0');
23
                Zi      : in signed(WIDTH -1 downto 0);
24
 
25
                Xo      : out signed(WIDTH -1 downto 0);
26
                Yo      : out signed(WIDTH -1 downto 0)
27
        );
28
end entity p2r_Cordic;
29
 
30
 
31
architecture dataflow of p2r_cordic is
32
 
33
        --
34
        --      TYPE defenitions
35
        --
36
        type XYVector is array(PIPELINE downto 0) of signed(WIDTH -1 downto 0);
37
        type ZVector is array(PIPELINE downto 0) of signed(19 downto 0);
38
 
39
        --
40
        --      COMPONENT declarations
41
        --
42
        component p2r_CordicPipe
43
        generic(
44
                WIDTH   : natural := 16;
45
                PIPEID  : natural := 1
46
        );
47
        port(
48
                clk             : in std_logic;
49
                ena             : in std_logic;
50
 
51
                Xi              : in signed(WIDTH -1 downto 0);
52
                Yi              : in signed(WIDTH -1 downto 0);
53
                Zi              : in signed(19 downto 0);
54
 
55
                Xo              : out signed(WIDTH -1 downto 0);
56
                Yo              : out signed(WIDTH -1 downto 0);
57
                Zo              : out signed(19 downto 0)
58
        );
59
        end component p2r_CordicPipe;
60
 
61
        --
62
        --      SIGNALS
63
        --
64
        signal X, Y     : XYVector;
65
        signal Z        : ZVector;
66
 
67
        --
68
        --      ACHITECTURE BODY
69
        --
70
begin
71
        -- fill first nodes
72
 
73
        -- fill X
74
        X(0) <= Xi;
75
 
76
        -- fill Y
77
        Y(0) <= Yi;
78
 
79
        -- fill Z
80
        Z(0)(19 downto 4) <= Zi;
81
        Z(0)(3 downto 0) <= (others => '0');
82
 
83
        --
84
        -- generate pipeline
85
        --
86
        gen_pipe:
87
        for n in 1 to PIPELINE generate
88
                Pipe: p2r_CordicPipe
89
                        generic map(WIDTH => WIDTH, PIPEID => n -1)
90
                        port map ( clk, ena, X(n-1), Y(n-1), Z(n-1), X(n), Y(n), Z(n) );
91
        end generate gen_pipe;
92
 
93
        --
94
        -- assign outputs
95
        --
96
        Xo <= X(PIPELINE);
97
        Yo <= Y(PIPELINE);
98
end dataflow;
99
 
100
 

powered by: WebSVN 2.1.0

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