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 use lpp.lpp_memory.all; 00029 00031 00032 entity Top_FIFO is 00033 generic( 00034 Data_sz : integer := 16; 00035 Addr_sz : integer := 8; 00036 addr_max_int : integer := 256 00037 ); 00038 port( 00039 clk,raz : in std_logic; 00040 flag_RE : in std_logic; 00041 flag_WR : in std_logic; 00042 Data_in : in std_logic_vector(Data_sz-1 downto 0); 00043 Addr_RE : out std_logic_vector(addr_sz-1 downto 0); 00044 Addr_WR : out std_logic_vector(addr_sz-1 downto 0); 00045 full : out std_logic; 00046 empty : out std_logic; 00047 Data_out : out std_logic_vector(Data_sz-1 downto 0) 00048 ); 00049 end Top_FIFO; 00050 00053 00054 architecture ar_Top_FIFO of Top_FIFO is 00055 00056 component syncram_2p 00057 generic (tech : integer := 0; abits : integer := 6; dbits : integer := 8; sepclk : integer := 0); 00058 port ( 00059 rclk : in std_ulogic; 00060 renable : in std_ulogic; 00061 raddress : in std_logic_vector((abits -1) downto 0); 00062 dataout : out std_logic_vector((dbits -1) downto 0); 00063 wclk : in std_ulogic; 00064 write : in std_ulogic; 00065 waddress : in std_logic_vector((abits -1) downto 0); 00066 datain : in std_logic_vector((dbits -1) downto 0)); 00067 end component; 00068 00069 signal Raddr : std_logic_vector(addr_sz-1 downto 0); 00070 signal Waddr : std_logic_vector(addr_sz-1 downto 0); 00071 signal Data_int : std_logic_vector(Data_sz-1 downto 0); 00072 signal s_empty : std_logic; 00073 signal s_full : std_logic; 00074 signal s_flag_RE : std_logic; 00075 signal s_flag_WR : std_logic; 00076 00077 begin 00078 00079 WR : Fifo_Write 00080 generic map(Addr_sz,addr_max_int) 00081 port map(clk,raz,s_flag_WR,Raddr,s_full,Waddr); 00082 00083 00084 SRAM : syncram_2p 00085 generic map(CFG_MEMTECH,Addr_sz,Data_sz) 00086 port map(clk,s_flag_RE,Raddr,Data_int,clk,s_flag_WR,Waddr,Data_in); 00087 00088 00089 link : Link_Reg 00090 generic map(Data_sz) 00091 port map(clk,raz,Data_in,Data_int,s_flag_RE,s_flag_WR,s_empty,Data_out); 00092 00093 RE : Fifo_Read 00094 generic map(Addr_sz,addr_max_int) 00095 port map(clk,raz,s_flag_RE,Waddr,s_empty,Raddr); 00096 00097 process(clk,raz) 00098 begin 00099 if(raz='0')then 00100 s_flag_RE <= '0'; 00101 s_flag_WR <= '0'; 00102 00103 elsif(clk'event and clk='1')then 00104 if(s_full='0')then 00105 s_flag_WR <= Flag_WR; 00106 else 00107 s_flag_WR <= '0'; 00108 end if; 00109 00110 if(s_empty='0')then 00111 s_flag_RE <= Flag_RE; 00112 else 00113 s_flag_RE <= '0'; 00114 end if; 00115 00116 end if; 00117 end process; 00118 00119 full <= s_full; 00120 empty <= s_empty; 00121 Addr_RE <= Raddr; 00122 Addr_WR <= Waddr; 00123 00124 end ar_Top_FIFO;
© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet