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.std_logic_1164.all; 00024 00025 00026 00027 package general_purpose is 00028 00029 00030 00031 component Clk_divider is 00032 generic(OSC_freqHz : integer := 50000000; 00033 TargetFreq_Hz : integer := 50000); 00034 Port ( clk : in STD_LOGIC; 00035 reset : in STD_LOGIC; 00036 clk_divided : out STD_LOGIC); 00037 end component; 00038 00039 00040 component Adder is 00041 generic( 00042 Input_SZ_A : integer := 16; 00043 Input_SZ_B : integer := 16 00044 00045 ); 00046 port( 00047 clk : in std_logic; 00048 reset : in std_logic; 00049 clr : in std_logic; 00050 add : in std_logic; 00051 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0); 00052 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0); 00053 RES : out std_logic_vector(Input_SZ_A-1 downto 0) 00054 ); 00055 end component; 00056 00057 component ADDRcntr is 00058 port( 00059 clk : in std_logic; 00060 reset : in std_logic; 00061 count : in std_logic; 00062 clr : in std_logic; 00063 Q : out std_logic_vector(7 downto 0) 00064 ); 00065 end component; 00066 00067 component ALU is 00068 generic( 00069 Arith_en : integer := 1; 00070 Logic_en : integer := 1; 00071 Input_SZ_1 : integer := 16; 00072 Input_SZ_2 : integer := 9 00073 00074 ); 00075 port( 00076 clk : in std_logic; 00077 reset : in std_logic; 00078 ctrl : in std_logic_vector(3 downto 0); 00079 OP1 : in std_logic_vector(Input_SZ_1-1 downto 0); 00080 OP2 : in std_logic_vector(Input_SZ_2-1 downto 0); 00081 RES : out std_logic_vector(Input_SZ_1+Input_SZ_2-1 downto 0) 00082 ); 00083 end component; 00084 00085 00086 component MAC is 00087 generic( 00088 Input_SZ_A : integer := 8; 00089 Input_SZ_B : integer := 8 00090 00091 ); 00092 port( 00093 clk : in std_logic; 00094 reset : in std_logic; 00095 clr_MAC : in std_logic; 00096 MAC_MUL_ADD : in std_logic_vector(1 downto 0); 00097 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0); 00098 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0); 00099 RES : out std_logic_vector(Input_SZ_A+Input_SZ_B-1 downto 0) 00100 ); 00101 end component; 00102 00103 00104 component MAC_CONTROLER is 00105 port( 00106 ctrl : in std_logic_vector(1 downto 0); 00107 MULT : out std_logic; 00108 ADD : out std_logic; 00109 MACMUX_sel : out std_logic; 00110 MACMUX2_sel : out std_logic 00111 00112 ); 00113 end component; 00114 00115 component MAC_MUX is 00116 generic( 00117 Input_SZ_A : integer := 16; 00118 Input_SZ_B : integer := 16 00119 00120 ); 00121 port( 00122 sel : in std_logic; 00123 INA1 : in std_logic_vector(Input_SZ_A-1 downto 0); 00124 INA2 : in std_logic_vector(Input_SZ_A-1 downto 0); 00125 INB1 : in std_logic_vector(Input_SZ_B-1 downto 0); 00126 INB2 : in std_logic_vector(Input_SZ_B-1 downto 0); 00127 OUTA : out std_logic_vector(Input_SZ_A-1 downto 0); 00128 OUTB : out std_logic_vector(Input_SZ_B-1 downto 0) 00129 ); 00130 end component; 00131 00132 00133 component MAC_MUX2 is 00134 generic(Input_SZ : integer := 16); 00135 port( 00136 sel : in std_logic; 00137 RES1 : in std_logic_vector(Input_SZ-1 downto 0); 00138 RES2 : in std_logic_vector(Input_SZ-1 downto 0); 00139 RES : out std_logic_vector(Input_SZ-1 downto 0) 00140 ); 00141 end component; 00142 00143 00144 component MAC_REG is 00145 generic(size : integer := 16); 00146 port( 00147 reset : in std_logic; 00148 clk : in std_logic; 00149 D : in std_logic_vector(size-1 downto 0); 00150 Q : out std_logic_vector(size-1 downto 0) 00151 ); 00152 end component; 00153 00154 00155 component MUX2 is 00156 generic(Input_SZ : integer := 16); 00157 port( 00158 sel : in std_logic; 00159 IN1 : in std_logic_vector(Input_SZ-1 downto 0); 00160 IN2 : in std_logic_vector(Input_SZ-1 downto 0); 00161 RES : out std_logic_vector(Input_SZ-1 downto 0) 00162 ); 00163 end component; 00164 00165 component Multiplier is 00166 generic( 00167 Input_SZ_A : integer := 16; 00168 Input_SZ_B : integer := 16 00169 00170 ); 00171 port( 00172 clk : in std_logic; 00173 reset : in std_logic; 00174 mult : in std_logic; 00175 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0); 00176 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0); 00177 RES : out std_logic_vector(Input_SZ_A+Input_SZ_B-1 downto 0) 00178 ); 00179 end component; 00180 00181 component REG is 00182 generic(size : integer := 16 ; initial_VALUE : integer := 0); 00183 port( 00184 reset : in std_logic; 00185 clk : in std_logic; 00186 D : in std_logic_vector(size-1 downto 0); 00187 Q : out std_logic_vector(size-1 downto 0) 00188 ); 00189 end component; 00190 00191 00192 00193 component RShifter is 00194 generic( 00195 Input_SZ : integer := 16; 00196 shift_SZ : integer := 4 00197 ); 00198 port( 00199 clk : in std_logic; 00200 reset : in std_logic; 00201 shift : in std_logic; 00202 OP : in std_logic_vector(Input_SZ-1 downto 0); 00203 cnt : in std_logic_vector(shift_SZ-1 downto 0); 00204 RES : out std_logic_vector(Input_SZ-1 downto 0) 00205 ); 00206 end component; 00207 00208 end;
© Copyright 2011 LPP-CNRS | Design by Alexis Jeandet