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

Subversion Repositories ofdm

[/] [ofdm/] [branches/] [avendor/] [p2r_cordic.vhd] - Diff between revs 4 and 13

Only display areas with differences | Details | Blame | View Log

Rev 4 Rev 13
--
--
--      VHDL implementation of cordic algorithm
--      VHDL implementation of cordic algorithm
--
--
-- File: p2r_cordic.vhd
-- File: p2r_cordic.vhd
-- author: Richard Herveille
-- author: Richard Herveille
-- rev. 1.0 initial release
-- rev. 1.0 initial release
--
--
 
 
--
--
--
--
-- This file is come from www.opencores.org
-- This file is come from www.opencores.org
-- 
-- 
-- It has been modified by zhaom to enable 20 bit phase input
-- It has been modified by zhaom to enable 20 bit phase input
--
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--
--
-- Title       : p2r_cordic
-- Title       : p2r_cordic
-- Design      : cfft
-- Design      : cfft
--
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--
--
-- File        : p2r_cordic.vhd
-- File        : p2r_cordic.vhd
--
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--
--
-- Description : Cordic arith pilepline 
-- Description : Cordic arith pilepline 
--
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--
--
-- Revisions       :    0
-- Revisions       :    0
-- Revision Number :    1
-- Revision Number :    1
-- Version         :    1
-- Version         :    1
-- Date            :    Oct 17 2002
-- Date            :    Oct 17 2002
-- Modifier        :    ZHAO Ming <sradio@opencores.org>
-- Modifier        :    ZHAO Ming <sradio@opencores.org>
-- Desccription    :    Data width configurable 
-- Desccription    :    Data width configurable 
--
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
 
 
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_arith.all;
 
 
entity p2r_cordic is
entity p2r_cordic is
        generic(
        generic(
                PIPELINE : integer := 15;
                PIPELINE : integer := 15;
                WIDTH    : integer := 16);
                WIDTH    : integer := 16);
        port(
        port(
                clk     : in std_logic;
                clk     : in std_logic;
                ena : in std_logic;
                ena : in std_logic;
 
 
                Xi      : in signed(WIDTH -1 downto 0);
                Xi      : in signed(WIDTH -1 downto 0);
                Yi : in signed(WIDTH -1 downto 0) := (others => '0');
                Yi : in signed(WIDTH -1 downto 0) := (others => '0');
                Zi      : in signed(19 downto 0);
                Zi      : in signed(19 downto 0);
 
 
                Xo      : out signed(WIDTH -1 downto 0);
                Xo      : out signed(WIDTH -1 downto 0);
                Yo      : out signed(WIDTH -1 downto 0)
                Yo      : out signed(WIDTH -1 downto 0)
        );
        );
end entity p2r_Cordic;
end entity p2r_Cordic;
 
 
 
 
architecture dataflow of p2r_cordic is
architecture dataflow of p2r_cordic is
 
 
        --
        --
        --      TYPE defenitions
        --      TYPE defenitions
        --
        --
        type XYVector is array(PIPELINE downto 0) of signed(WIDTH -1 downto 0);
        type XYVector is array(PIPELINE downto 0) of signed(WIDTH -1 downto 0);
        type ZVector is array(PIPELINE downto 0) of signed(19 downto 0);
        type ZVector is array(PIPELINE downto 0) of signed(19 downto 0);
 
 
        --
        --
        --      COMPONENT declarations
        --      COMPONENT declarations
        --
        --
        component p2r_CordicPipe
        component p2r_CordicPipe
        generic(
        generic(
                WIDTH   : natural := 16;
                WIDTH   : natural := 16;
                PIPEID  : natural := 1
                PIPEID  : natural := 1
        );
        );
        port(
        port(
                clk             : in std_logic;
                clk             : in std_logic;
                ena             : in std_logic;
                ena             : in std_logic;
 
 
                Xi              : in signed(WIDTH -1 downto 0);
                Xi              : in signed(WIDTH -1 downto 0);
                Yi              : in signed(WIDTH -1 downto 0);
                Yi              : in signed(WIDTH -1 downto 0);
                Zi              : in signed(19 downto 0);
                Zi              : in signed(19 downto 0);
 
 
                Xo              : out signed(WIDTH -1 downto 0);
                Xo              : out signed(WIDTH -1 downto 0);
                Yo              : out signed(WIDTH -1 downto 0);
                Yo              : out signed(WIDTH -1 downto 0);
                Zo              : out signed(19 downto 0)
                Zo              : out signed(19 downto 0)
        );
        );
        end component p2r_CordicPipe;
        end component p2r_CordicPipe;
 
 
        --
        --
        --      SIGNALS
        --      SIGNALS
        --
        --
        signal X, Y     : XYVector;
        signal X, Y     : XYVector;
        signal Z        : ZVector;
        signal Z        : ZVector;
 
 
        --
        --
        --      ACHITECTURE BODY
        --      ACHITECTURE BODY
        --
        --
begin
begin
        -- fill first nodes
        -- fill first nodes
 
 
        -- fill X
        -- fill X
        X(0) <= Xi;
        X(0) <= Xi;
 
 
        -- fill Y
        -- fill Y
        Y(0) <= Yi;
        Y(0) <= Yi;
 
 
        -- fill Z
        -- fill Z
        Z(0)(19 downto 0) <= Zi;                          -- modified by zhaom
        Z(0)(19 downto 0) <= Zi;                          -- modified by zhaom
        --Z(0)(3 downto 0) <= (others => '0');  -- modified by zhaom
        --Z(0)(3 downto 0) <= (others => '0');  -- modified by zhaom
 
 
        --
        --
        -- generate pipeline
        -- generate pipeline
        --
        --
        gen_pipe:
        gen_pipe:
        for n in 1 to PIPELINE generate
        for n in 1 to PIPELINE generate
                Pipe: p2r_CordicPipe
                Pipe: p2r_CordicPipe
                        generic map(WIDTH => WIDTH, PIPEID => n -1)
                        generic map(WIDTH => WIDTH, PIPEID => n -1)
                        port map ( clk, ena, X(n-1), Y(n-1), Z(n-1), X(n), Y(n), Z(n) );
                        port map ( clk, ena, X(n-1), Y(n-1), Z(n-1), X(n), Y(n), Z(n) );
        end generate gen_pipe;
        end generate gen_pipe;
 
 
        --
        --
        -- assign outputs
        -- assign outputs
        --
        --
        Xo <= X(PIPELINE);
        Xo <= X(PIPELINE);
        Yo <= Y(PIPELINE);
        Yo <= Y(PIPELINE);
end dataflow;
end dataflow;
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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