Free VHDL library

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

dsp/iir_filter/RAM_CTRLR2.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.numeric_std.all;
00024 use IEEE.std_logic_1164.all;
00025 library lpp;
00026 use lpp.iir_filter.all;
00027 use lpp.FILTERcfg.all;
00028 use lpp.general_purpose.all;
00029 
00030 --TODO amliorer la flexibilit de la config de la RAM.
00031 
00032 entity  RAM_CTRLR2 is
00033 generic(
00034     Input_SZ_1      :   integer := 16;
00035          Mem_use         :   integer := use_RAM
00036 );
00037 port(
00038     reset       :   in  std_logic;
00039     clk         :   in  std_logic;
00040     WD_sel      :   in  std_logic;
00041     Read        :   in  std_logic;
00042     WADDR_sel   :   in  std_logic;
00043     count       :   in  std_logic;
00044     SVG_ADDR    :   in  std_logic;
00045     Write       :   in  std_logic;
00046     GO_0        :   in  std_logic;
00047     sample_in   :   in  std_logic_vector(Input_SZ_1-1 downto 0);
00048     sample_out  :   out std_logic_vector(Input_SZ_1-1 downto 0)
00049 );
00050 end RAM_CTRLR2;
00051 
00052 
00053 architecture ar_RAM_CTRLR2 of RAM_CTRLR2 is
00054 
00055 signal  WD          :   std_logic_vector(35 downto 0); 
00056 signal  WD_D        :   std_logic_vector(35 downto 0); 
00057 signal  RD          :   std_logic_vector(35 downto 0);
00058 signal  WEN, REN    :   std_logic; 
00059 signal  WADDR_back  :   std_logic_vector(7 downto 0); 
00060 signal  WADDR_back_D:   std_logic_vector(7 downto 0); 
00061 signal  RADDR       :   std_logic_vector(7 downto 0); 
00062 signal  WADDR       :   std_logic_vector(7 downto 0);
00063 signal  WADDR_D     :   std_logic_vector(7 downto 0);
00064 
00065 
00066 
00067 begin
00068 
00069 sample_out  <=  RD(Input_SZ_1-1 downto 0);
00070 
00071 
00072 WEN <=  not Write;
00073 REN <=  not read;
00074 
00075 
00076 --==============================================================
00077 --=========================R A M================================
00078 --==============================================================
00079 memRAM :   if Mem_use = use_RAM generate
00080 RAMblk :RAM 
00081     port map( 
00082     WD       =>  WD_D,
00083     RD       =>  RD,
00084     WEN      =>  WEN,
00085     REN      =>  REN,
00086     WADDR    =>  WADDR ,
00087     RADDR    =>  RADDR ,
00088     RWCLK    =>  clk,
00089     RESET    =>  reset 
00090         ) ;
00091 end generate;
00092 
00093 memCEL :   if Mem_use = use_CEL generate
00094 RAMblk :RAM_CEL
00095     port map( 
00096     WD       =>  WD_D,
00097     RD       =>  RD,
00098     WEN      =>  WEN,
00099     REN      =>  REN,
00100     WADDR    =>  WADDR ,
00101     RADDR    =>  RADDR ,
00102     RWCLK    =>  clk,
00103     RESET    =>  reset 
00104         ) ;
00105 end generate;
00106 --==============================================================
00107 --==============================================================
00108 
00109 
00110 ADDRcntr_inst : ADDRcntr 
00111 port map(
00112     clk      =>  clk,
00113     reset    =>  reset ,
00114     count    =>  count ,
00115     clr      =>  GO_0,
00116     Q        =>  RADDR 
00117 );
00118 
00119 
00120 
00121 MUX2_inst1 :MUX2 
00122 generic map(Input_SZ     => Input_SZ_1)
00123 port map(
00124     sel      =>  WD_sel ,
00125     IN1      =>  sample_in,
00126     IN2      =>  RD(Input_SZ_1-1 downto 0),
00127     RES      =>  WD(Input_SZ_1-1 downto 0)
00128 );
00129 
00130 
00131 MUX2_inst2 :MUX2 
00132 generic map(Input_SZ     => 8)
00133 port map(
00134     sel      =>  WADDR_sel,
00135     IN1      =>  WADDR_D ,
00136     IN2      =>  WADDR_back_D ,
00137     RES      =>  WADDR 
00138 );
00139 
00140 
00141 
00142 
00143 WADDR_backreg :REG
00144 generic map(size     => 8,initial_VALUE  =>ChanelsCNT*Cels_count*4 -2)
00145 port map(
00146     reset    =>  reset ,
00147     clk      =>  SVG_ADDR ,
00148     D        =>  RADDR ,
00149     Q        =>  WADDR_back 
00150 );
00151 
00152 WADDR_backreg2 :REG
00153 generic map(size     => 8)
00154 port map(
00155     reset    =>  reset ,
00156     clk      =>  SVG_ADDR ,
00157     D        =>  WADDR_back ,
00158     Q        =>  WADDR_back_D 
00159 );
00160 
00161 WDRreg :REG
00162 generic map(size     => Input_SZ_1)
00163 port map(
00164     reset    =>  reset ,
00165     clk      =>  clk,
00166     D        =>  WD(Input_SZ_1-1 downto 0),
00167     Q        =>  WD_D(Input_SZ_1-1 downto 0)
00168 );
00169 
00170 
00171 
00172 
00173 ADDRreg :REG
00174 generic map(size     => 8)
00175 port map(
00176     reset    =>  reset ,
00177     clk      =>  clk,
00178     D        =>  RADDR ,
00179     Q        =>  WADDR_D 
00180 );
00181 
00182 
00183 
00184 end ar_RAM_CTRLR2;
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 

© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet