Free VHDL library

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

lpp_memory/Top_FifoWrite.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_FifoWrite 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     Raddr    : in std_logic_vector(addr_sz-1 downto 0);
00042     full     : out std_logic;
00043     Waddr    : 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_FifoWrite;
00047 
00050 
00051 architecture ar_Top_FifoWrite of Top_FifoWrite 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 Waddr_int : std_logic_vector(addr_sz-1 downto 0);
00067 signal s_flag_WR : std_logic;
00068 signal s_full    : std_logic;
00069 
00070 begin
00071 
00072 
00073     WR : entity work.Fifo_Write         generic map(Addr_sz,addr_max_int)
00074         port map(clk,raz,s_flag_WR,Raddr,s_full,Waddr_int);
00075 
00076    
00077     SRAM : syncram_2p
00078         generic map(CFG_MEMTECH,Addr_sz,Data_sz)
00079         port map(clk,flag_RE,Raddr,Data_out,clk,s_flag_WR,Waddr_int,Data_in);
00080 
00081     
00082     process(clk,raz)
00083     begin
00084         if(raz='0')then            
00085             s_flag_WR <= '0';
00086 
00087         elsif(clk'event and clk='1')then
00088             if(s_full='0')then
00089                 s_flag_WR <= Flag_WR;
00090             else
00091                 s_flag_WR <= '0';
00092             end if;            
00093             
00094         end if;
00095     end process;
00096 
00097 Waddr <= Waddr_int;
00098 full  <= s_full;
00099 
00100 end ar_Top_FifoWrite; 
00101 

© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet