Free VHDL library

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

lpp_memory/Link_Reg.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 use work.FIFO_Config.all;
00026 
00028 
00029 entity Link_Reg is
00030 generic(Data_sz : integer := 16);
00031 port( 
00032     clk,raz  : in std_logic;
00033     Data_one : in std_logic_vector(Data_sz-1 downto 0);
00034     Data_two : in std_logic_vector(Data_sz-1 downto 0);
00035     flag_RE  : in std_logic;
00036     flag_WR  : in std_logic;
00037     empty    : in std_logic;
00038     Data_out : out std_logic_vector(Data_sz-1 downto 0)
00039     );
00040 end Link_Reg;
00041 
00042 architecture ar_Link_Reg of Link_Reg is
00043 
00044 type etat is (e0,e1,e2,e3);
00045 signal ect : etat;
00046 
00047 begin 
00048     process (clk,raz)
00049     begin
00050         if(raz='0')then
00051             Data_out <= (others => 'X');
00052             ect      <= e0;
00053             
00054         elsif(clk' event and clk='1')then
00055             case ect is
00056                 when e0 =>
00057                     if(flag_WR='1')then
00058                         Data_out <= Data_one;
00059                         ect      <= e1;
00060                     end if;
00061 
00062                 when e1 =>
00063                     if(flag_RE='1')then
00064                         Data_out <= Data_two;
00065                         ect      <= e2;
00066                     end if;
00067                 
00068                 when e2 =>
00069                     if(empty='1')then
00070                         ect <= e3;
00071                     else
00072                         Data_out <= Data_two;
00073                         ect      <= e2;
00074                     end if;
00075 
00076                 when e3 =>
00077                     Data_out <= Data_two;
00078                     ect      <= e0;
00079 
00080             end case;                        
00081         end if;
00082     end process;
00083     
00084 end ar_Link_Reg;
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 

© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet