Free VHDL library

  • Main Page
  • Related Pages
  • Design Unit List
  • Files
  • File List

dsp/iir_filter/iir_filter.vhd

Go to the documentation of this file.
00001 ------------------------------------------------------------------------------
00002 --  This file is a part of the LPP VHDL IP LIBRARY
00003 --  Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
00004 --
00005 --  This program is free software; you can redistribute it and/or modify
00006 --  it under the terms of the GNU General Public License as published by
00007 --  the Free Software Foundation; either version 3 of the License, or
00008 --  (at your option) any later version.
00009 --
00010 --  This program is distributed in the hope that it will be useful,
00011 --  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 --  GNU General Public License for more details.
00014 --
00015 --  You should have received a copy of the GNU General Public License
00016 --  along with this program; if not, write to the Free Software
00017 --  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
00018 -------------------------------------------------------------------------------
00019 --                    Author : Alexis Jeandet
00020 --                     Mail : alexis.jeandet@lpp.polytechnique.fr
00021 ----------------------------------------------------------------------------
00022 library ieee;
00023 use ieee.std_logic_1164.all;
00024 library grlib;
00025 use grlib.amba.all;
00026 use grlib.stdlib.all;
00027 use grlib.devices.all;
00028 library lpp;
00029 
00030 
00031 
00032 
00033 package iir_filter is
00034 
00035 
00036 --===========================================================|
00037 --================A L U   C O N T R O L======================|
00038 --===========================================================|
00039 constant    IDLE    :   std_logic_vector(3 downto 0) := "0000";
00040 constant    MAC_op  :   std_logic_vector(3 downto 0) := "0001";
00041 constant    MULT    :   std_logic_vector(3 downto 0) := "0010";
00042 constant    ADD     :   std_logic_vector(3 downto 0) := "0011";
00043 constant    clr_mac :   std_logic_vector(3 downto 0) := "0100";
00044 
00045 --____
00046 --RAM |
00047 --____|
00048 constant use_RAM    :   integer := 1;
00049 constant use_CEL    :   integer := 0;
00050 
00051 
00052 --===========================================================|
00053 --=============C O E F S ====================================|
00054 --===========================================================|
00055 --  create a specific type of data for coefs to avoid errors |
00056 --===========================================================|
00057 
00058 type    scaleValT   is array(natural range <>) of integer;
00059 
00060 type    samplT   is array(natural range <>,natural range <>) of std_logic;
00061 
00062 type in_IIR_CEL_reg is record
00063   config    :   std_logic_vector(31 downto 0);
00064   virgPos   :   std_logic_vector(4 downto 0);
00065 end record;
00066 
00067 type out_IIR_CEL_reg is record
00068   config    :   std_logic_vector(31 downto 0);
00069   status    :   std_logic_vector(31 downto 0);
00070 end record;
00071 
00072 
00073 
00074 component APB_IIR_CEL is
00075   generic (
00076     pindex   : integer  := 0;
00077     paddr    : integer  := 0;
00078     pmask    : integer  := 16#fff#;
00079     pirq     : integer  := 0;
00080     abits    : integer  := 8;
00081     Sample_SZ : integer := 16;
00082     ChanelsCount : integer := 1;
00083          Coef_SZ      : integer := 9;
00084          CoefCntPerCel: integer := 3;
00085          Cels_count   : integer := 5;
00086          virgPos      : integer := 3;
00087     Mem_use      : integer := use_RAM
00088     );
00089   port (
00090     rst             : in  std_logic;
00091     clk             : in  std_logic;
00092     apbi            : in  apb_slv_in_type;
00093     apbo            : out apb_slv_out_type;
00094     sample_clk      : in  std_logic;
00095     sample_clk_out  : out std_logic;
00096     sample_in   :   in  samplT(ChanelsCount-1 downto 0,Sample_SZ-1 downto 0);
00097     sample_out  :   out samplT(ChanelsCount-1 downto 0,Sample_SZ-1 downto 0)
00098     );
00099 end component;
00100 
00101 
00102 --component FILTER is 
00103 --generic(Smpl_SZ    :  integer := 16;
00104 --        ChanelsCNT :  integer := 3
00105 --);
00106 --port(
00107 --
00108 --    reset       :   in  std_logic;
00109 --    clk         :   in  std_logic;
00110 --    sample_clk  :   in  std_logic;
00111 --    Sample_IN   :   in  std_logic_vector(Smpl_SZ*ChanelsCNT-1 downto 0);
00112 --    Sample_OUT  :   out std_logic_vector(Smpl_SZ*ChanelsCNT-1 downto 0)
00113 --);
00114 --end component;
00115 
00116 
00117 
00118 --component  FilterCTRLR is
00119 --port(
00120 --    reset       :   in  std_logic;
00121 --    clk         :   in  std_logic;
00122 --    sample_clk  :   in  std_logic;
00123 --    ALU_Ctrl    :   out std_logic_vector(3 downto 0);
00124 --    sample_in   :   in  samplT;
00125 --    coef        :   out std_logic_vector(Coef_SZ-1 downto 0);
00126 --    sample      :   out std_logic_vector(Smpl_SZ-1 downto 0)
00127 --);
00128 --end component;
00129 
00130 
00131 --component  FILTER_RAM_CTRLR is
00132 --port(
00133 --    reset       :   in  std_logic;
00134 --    clk         :   in  std_logic;
00135 --    run         :   in  std_logic;
00136 --    GO_0        :   in  std_logic;
00137 --    B_A         :   in  std_logic;
00138 --    writeForce  :   in  std_logic;
00139 --    next_blk    :   in  std_logic;
00140 --    sample_in   :   in  std_logic_vector(Smpl_SZ-1 downto 0);
00141 --    sample_out  :   out std_logic_vector(Smpl_SZ-1 downto 0)
00142 --);
00143 --end component;
00144 
00145 
00146 component  IIR_CEL_CTRLR is
00147 generic(Sample_SZ : integer := 16;
00148                   ChanelsCount : integer := 1;
00149                   Coef_SZ      : integer := 9;
00150                   CoefCntPerCel: integer := 3;
00151                   Cels_count   : integer := 5;
00152         Mem_use      : integer := use_RAM
00153 );
00154 port(
00155     reset       :   in  std_logic;
00156     clk         :   in  std_logic;
00157     sample_clk  :   in  std_logic;
00158     sample_in   :   in  samplT(ChanelsCount-1 downto 0,Sample_SZ-1 downto 0);
00159     sample_out  :   out samplT(ChanelsCount-1 downto 0,Sample_SZ-1 downto 0);
00160     virg_pos    :   in  integer;
00161     coefs       :   in  std_logic_vector(Coef_SZ*CoefCntPerCel*Cels_count-1 downto 0)
00162 );
00163 end component;
00164 
00165 
00166 component RAM is 
00167     port( WD : in std_logic_vector(35 downto 0); RD : out 
00168         std_logic_vector(35 downto 0);WEN, REN : in std_logic; 
00169         WADDR : in std_logic_vector(7 downto 0); RADDR : in 
00170         std_logic_vector(7 downto 0);RWCLK, RESET : in std_logic
00171         ) ;
00172 end component;
00173 
00174 
00175 component RAM_CEL is 
00176     port( WD : in std_logic_vector(35 downto 0); RD : out 
00177         std_logic_vector(35 downto 0);WEN, REN : in std_logic; 
00178         WADDR : in std_logic_vector(7 downto 0); RADDR : in 
00179         std_logic_vector(7 downto 0);RWCLK, RESET : in std_logic
00180         ) ;
00181 end component;
00182 
00183 component  IIR_CEL_FILTER is
00184 generic(Sample_SZ : integer := 16;
00185                   ChanelsCount : integer := 1;
00186                   Coef_SZ      : integer := 9;
00187                   CoefCntPerCel: integer := 3;
00188                   Cels_count   : integer := 5;
00189         Mem_use      : integer := use_RAM);
00190 port(
00191     reset       :   in  std_logic;
00192     clk         :   in  std_logic;
00193     sample_clk  :   in  std_logic;
00194     regs_in     :   in  in_IIR_CEL_reg;
00195     regs_out    :   in  out_IIR_CEL_reg;
00196     sample_in   :   in  samplT(ChanelsCount-1 downto 0,Sample_SZ-1 downto 0);
00197     sample_out  :   out samplT(ChanelsCount-1 downto 0,Sample_SZ-1 downto 0);
00198          coefs       :   in  std_logic_vector(Coef_SZ*CoefCntPerCel*Cels_count-1 downto 0)
00199     
00200 );
00201 end component;
00202 
00203 
00204 component  RAM_CTRLR2 is
00205 generic(
00206     Input_SZ_1      :   integer := 16;
00207          Mem_use         :   integer := use_RAM
00208 );
00209 port(
00210     reset       :   in  std_logic;
00211     clk         :   in  std_logic;
00212     WD_sel      :   in  std_logic;
00213     Read        :   in  std_logic;
00214     WADDR_sel   :   in  std_logic;
00215     count       :   in  std_logic;
00216     SVG_ADDR    :   in  std_logic;
00217     Write       :   in  std_logic;
00218     GO_0        :   in  std_logic;
00219     sample_in   :   in  std_logic_vector(Input_SZ_1-1 downto 0);
00220     sample_out  :   out std_logic_vector(Input_SZ_1-1 downto 0)
00221 );
00222 end component;
00223 
00224 
00225 end;

© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet