Free VHDL library

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

lpp_memory/Top_FifoRead.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 : Martin Morlot
00020 --                     Mail : martin.morlot@lpp.polytechnique.fr
00021 ------------------------------------------------------------------------------
00022 library IEEE;
00023 use IEEE.std_logic_1164.all;
00024 use IEEE.numeric_std.all;
00025 library techmap;
00026 use techmap.gencomp.all;
00027 use work.config.all;
00028 
00030 
00031 entity Top_FifoRead is
00032   generic(
00033     Data_sz      : integer := 16;
00034     Addr_sz      : integer := 8;
00035     addr_max_int : integer := 256);
00036   port(
00037     clk,raz  : in std_logic;
00038     flag_RE  : in std_logic;
00039     flag_WR  : in std_logic;
00040     Data_in  : in std_logic_vector(Data_sz-1 downto 0);
00041     Waddr    : in std_logic_vector(addr_sz-1 downto 0);
00042     empty    : out std_logic;
00043     Raddr    : out std_logic_vector(addr_sz-1 downto 0);
00044     Data_out : out std_logic_vector(Data_sz-1 downto 0)
00045     );
00046 end Top_FifoRead;
00047 
00050 
00051 architecture ar_Top_FifoRead of Top_FifoRead is
00052 
00053 component syncram_2p
00054     generic (tech : integer := 0; abits : integer := 6; dbits : integer := 8; sepclk : integer := 0);
00055     port (
00056         rclk     : in std_ulogic;
00057         renable  : in std_ulogic;
00058         raddress : in std_logic_vector((abits -1) downto 0);
00059         dataout  : out std_logic_vector((dbits -1) downto 0);
00060         wclk     : in std_ulogic;
00061         write    : in std_ulogic;
00062         waddress : in std_logic_vector((abits -1) downto 0);
00063         datain   : in std_logic_vector((dbits -1) downto 0));
00064 end component;
00065 
00066 signal Raddr_int  : std_logic_vector(addr_sz-1 downto 0);
00067 signal s_flag_RE  : std_logic;
00068 signal s_empty    : std_logic;
00069 
00070 begin 
00071    
00072     SRAM : syncram_2p
00073         generic map(CFG_MEMTECH,addr_sz,Data_sz)
00074         port map(clk,s_flag_RE,Waddr,Data_int,clk,flag_WR,Raddr_int,Data_in);
00075 
00076     
00077     RE : entity work.Fifo_Read         generic map(Addr_sz,addr_max_int)
00078         port map(clk,raz,s_flag_RE,Waddr,s_empty,Raddr_int);
00079 
00080     link : entity work.Link_Reg        generic map(Data_sz)
00081        port map(clk,raz,Data_in,Data_int,s_flag_RE,flag_WR,s_empty,Data_out);
00082 
00083     process(clk,raz)
00084     begin
00085         if(raz='0')then            
00086             s_flag_RE <= '0';
00087 
00088         elsif(clk'event and clk='1')then
00089             if(s_empty='0')then
00090                 s_flag_RE <= Flag_RE;
00091             else
00092                 s_flag_RE <= '0';
00093             end if;            
00094             
00095         end if;
00096     end process;
00097 
00098 empty  <= s_empty;
00099 Raddr <= Raddr_int;
00100 
00101 end ar_Top_FifoRead; 
00102 

© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet