📄 syncram_2p.vhd
字号:
-------------------------------------------------------------------------------- This file is a part of the GRLIB VHDL IP LIBRARY-- Copyright (C) 2003, Gaisler Research---- This program is free software; you can redistribute it and/or modify-- it under the terms of the GNU General Public License as published by-- the Free Software Foundation; either version 2 of the License, or-- (at your option) any later version.---- This program is distributed in the hope that it will be useful,-- but WITHOUT ANY WARRANTY; without even the implied warranty of-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-- GNU General Public License for more details.---- You should have received a copy of the GNU General Public License-- along with this program; if not, write to the Free Software-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- Entity: syncram_2p-- File: syncram_2p.vhd-- Author: Jiri Gaisler - Gaisler Research-- Description: syncronous 2-port ram with tech selection------------------------------------------------------------------------------library ieee;library techmap;use ieee.std_logic_1164.all;use techmap.gencomp.all;entity syncram_2p is generic (tech : integer := 0; abits : integer := 6; dbits : integer := 8; sepclk : integer := 0; wrfst : integer := 0); port ( rclk : in std_ulogic; renable : in std_ulogic; raddress : in std_logic_vector((abits -1) downto 0); dataout : out std_logic_vector((dbits -1) downto 0); wclk : in std_ulogic; write : in std_ulogic; waddress : in std_logic_vector((abits -1) downto 0); datain : in std_logic_vector((dbits -1) downto 0));end;architecture rtl of syncram_2p iscomponent ec_syncram_dp generic ( abits : integer := 10; dbits : integer := 8 ); port ( clk1 : in std_ulogic; address1 : in std_logic_vector((abits -1) downto 0); datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_ulogic; write1 : in std_ulogic; clk2 : in std_ulogic; address2 : in std_logic_vector((abits -1) downto 0); datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_ulogic; write2 : in std_ulogic ); end component;component altera_syncram_dp generic ( abits : integer := 10; dbits : integer := 8 ); port ( clk1 : in std_ulogic; address1 : in std_logic_vector((abits -1) downto 0); datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_ulogic; write1 : in std_ulogic; clk2 : in std_ulogic; address2 : in std_logic_vector((abits -1) downto 0); datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_ulogic; write2 : in std_ulogic ); end component; component virage_syncram_dp generic ( abits : integer := 10; dbits : integer := 8 ); port ( clk1 : in std_ulogic; address1 : in std_logic_vector((abits -1) downto 0); datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_ulogic; write1 : in std_ulogic; clk2 : in std_ulogic; address2 : in std_logic_vector((abits -1) downto 0); datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_ulogic; write2 : in std_ulogic); end component; component axcel_syncram_2p generic ( abits : integer := 8; dbits : integer := 32); port ( rclk : in std_ulogic; rena : in std_ulogic; raddr : in std_logic_vector (abits -1 downto 0); dout : out std_logic_vector (dbits -1 downto 0); wclk : in std_ulogic; waddr : in std_logic_vector (abits -1 downto 0); din : in std_logic_vector (dbits -1 downto 0); write : in std_ulogic); end component; component proasic_syncram_2p generic ( abits : integer := 8; dbits : integer := 32); port ( rclk : in std_ulogic; rena : in std_ulogic; raddr : in std_logic_vector (abits -1 downto 0); dout : out std_logic_vector (dbits -1 downto 0); wclk : in std_ulogic; waddr : in std_logic_vector (abits -1 downto 0); din : in std_logic_vector (dbits -1 downto 0); write : in std_ulogic); end component; component proasic3_syncram_2p generic ( abits : integer := 8; dbits : integer := 32); port ( rclk : in std_ulogic; rena : in std_ulogic; raddr : in std_logic_vector (abits -1 downto 0); dout : out std_logic_vector (dbits -1 downto 0); wclk : in std_ulogic; waddr : in std_logic_vector (abits -1 downto 0); din : in std_logic_vector (dbits -1 downto 0); write : in std_ulogic); end component; component generic_syncram_2p generic (abits : integer := 8; dbits : integer := 32; sepclk : integer := 0); port ( rclk : in std_ulogic; wclk : in std_ulogic; rdaddress: in std_logic_vector (abits -1 downto 0); wraddress: in std_logic_vector (abits -1 downto 0); data: in std_logic_vector (dbits -1 downto 0); wren : in std_ulogic; q: out std_logic_vector (dbits -1 downto 0)); end component;component virtex2_syncram_dp generic ( abits : integer := 10; dbits : integer := 8 ); port ( clk1 : in std_ulogic; address1 : in std_logic_vector((abits -1) downto 0); datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_ulogic; write1 : in std_ulogic; clk2 : in std_ulogic; address2 : in std_logic_vector((abits -1) downto 0); datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_ulogic; write2 : in std_ulogic ); end component;component virtex_syncram_dp generic ( abits : integer := 6; dbits : integer := 8 ); port ( clk1 : in std_ulogic; address1 : in std_logic_vector((abits -1) downto 0); datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_ulogic; write1 : in std_ulogic; clk2 : in std_ulogic; address2 : in std_logic_vector((abits -1) downto 0); datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_ulogic; write2 : in std_ulogic ); end component;component rh_lib18t_syncram_2p generic (abits : integer := 6; dbits : integer := 8); port ( rclk : in std_ulogic; renable : in std_ulogic; raddress : in std_logic_vector((abits -1) downto 0); dataout : out std_logic_vector((dbits -1) downto 0); write : in std_ulogic; waddress : in std_logic_vector((abits -1) downto 0); datain : in std_logic_vector((dbits -1) downto 0); diagin : in std_logic_vector(3 downto 0));end component; component ut025crh_syncram_2p generic ( abits : integer := 8; dbits : integer := 32); port ( rclk : in std_ulogic; rena : in std_ulogic; raddr : in std_logic_vector (abits -1 downto 0); dout : out std_logic_vector (dbits -1 downto 0); wclk : in std_ulogic; waddr : in std_logic_vector (abits -1 downto 0); din : in std_logic_vector (dbits -1 downto 0); write : in std_ulogic); end component; component artisan_syncram_2p generic ( abits : integer := 8; dbits : integer := 32); port ( rclk : in std_ulogic; renable : in std_ulogic; raddress : in std_logic_vector((abits -1) downto 0); dataout : out std_logic_vector((dbits -1) downto 0); wclk : in std_ulogic; write : in std_ulogic; waddress : in std_logic_vector((abits -1) downto 0); datain : in std_logic_vector((dbits -1) downto 0)); end component; component custom1_syncram_2p generic ( abits : integer := 8; dbits : integer := 32); port ( rclk : in std_ulogic; renable : in std_ulogic; raddress : in std_logic_vector((abits -1) downto 0); dataout : out std_logic_vector((dbits -1) downto 0); wclk : in std_ulogic; write : in std_ulogic; waddress : in std_logic_vector((abits -1) downto 0); datain : in std_logic_vector((dbits -1) downto 0)); end component;signal vcc, gnd : std_ulogic;signal vgnd : std_logic_vector(dbits-1 downto 0);signal write2, renable2 : std_ulogic;signal datain2 : std_logic_vector((dbits-1) downto 0); signal diagin : std_logic_vector(3 downto 0);begin vcc <= '1'; gnd <= '0'; vgnd <= (others => '0'); diagin <= (others => '0'); inf : if tech = inferred generate u0 : generic_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, wclk, raddress, waddress, datain, write, dataout); end generate; xcv : if tech = virtex generate u0 : virtex_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, write, write, rclk, raddress, vgnd, dataout, renable, gnd); end generate; xc2v : if (tech = virtex2) or (tech = spartan3) or (tech =virtex4) or (tech = spartan3e) or (tech = virtex5) generate nowf: if wrfst = 0 generate write2 <= '0'; renable2 <= renable; datain2 <= (others => '0'); end generate; wf : if wrfst = 1 generate write2 <= '0' when (waddress /= raddress) else write; renable2 <= renable or write2; datain2 <= datain; end generate; u0 : virtex2_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, write, write, rclk, raddress, datain2, dataout, renable2, write2); end generate; vir : if tech = memvirage generate u0 : virage_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, write, write, rclk, raddress, vgnd, dataout, renable, gnd); end generate; axc : if tech = axcel generate u0 : axcel_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, wclk, waddress, datain, write); end generate; proa : if tech = proasic generate u0 : proasic_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, wclk, waddress, datain, write); end generate; proa3 : if tech = proasic3 generate u0 : proasic3_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, wclk, waddress, datain, write); end generate; ihp : if tech = ihp25 generate u0 : generic_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, wclk, raddress, waddress, datain, write, dataout); end generate; -- NOTE: port 1 on altsyncram must be a read port due to Cyclone II M4K write issue alt : if tech = altera generate u0 : altera_syncram_dp generic map (abits, dbits) port map (rclk, raddress, vgnd, dataout, renable, gnd, wclk, waddress, datain, open, write, write); end generate; rh_lib18t0 : if tech = rhlib18t generate u0 : rh_lib18t_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, write, waddress, datain, diagin); end generate; lat : if tech = lattice generate u0 : ec_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, write, write, rclk, raddress, vgnd, dataout, renable, gnd); end generate; ut025 : if tech = ut25 generate u0 : ut025crh_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, wclk, waddress, datain, write); end generate; arti : if tech = memartisan generate u0 : artisan_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, wclk, write, waddress, datain); end generate; cust1 : if tech = custom1 generate u0 : custom1_syncram_2p generic map (abits, dbits) port map (rclk, renable, raddress, dataout, wclk, write, waddress, datain); end generate;-- pragma translate_off noram : if has_2pram(tech) = 0 generate x : process begin assert false report "synram_2p: technology " & tech_table(tech) & " not supported" severity failure; wait; end process; end generate; -- pragma translate_onend;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -