📄 xilinx_simprims.vhd
字号:
------------------------------------------------------------------------------ This file is a part of the GRLIB VHDL IP LIBRARY-- Copyright (C) 2004 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.---- See the file COPYING for the full details of the license.-------------------------------------------------------------------------------- Simple simulation models for some Xilinx blocks-- Author: Jiri Gaisler------------------------------------------------------------------------------ pragma translate_offlibrary ieee;use ieee.std_logic_1164.all;package simple_simprim is component ramb4_generic generic ( abits : integer := 10; dbits : integer := 8 ); port (DI : in std_logic_vector (dbits-1 downto 0); EN : in std_ulogic; WE : in std_ulogic; RST : in std_ulogic; CLK : in std_ulogic; ADDR : in std_logic_vector (abits-1 downto 0); DO : out std_logic_vector (dbits-1 downto 0) ); end component; component ramb4_sx_sx generic (abits : integer := 10; dbits : integer := 8 ); port (DIA : in std_logic_vector (dbits-1 downto 0); DIB : in std_logic_vector (dbits-1 downto 0); ENA : in std_ulogic; ENB : in std_ulogic; WEA : in std_ulogic; WEB : in std_ulogic; RSTA : in std_ulogic; RSTB : in std_ulogic; CLKA : in std_ulogic; CLKB : in std_ulogic; ADDRA : in std_logic_vector (abits-1 downto 0); ADDRB : in std_logic_vector (abits-1 downto 0); DOA : out std_logic_vector (dbits-1 downto 0); DOB : out std_logic_vector (dbits-1 downto 0) ); end component; component ramb16_sx generic (abits : integer := 10; dbits : integer := 8 ); port ( DO : out std_logic_vector (dbits-1 downto 0); ADDR : in std_logic_vector (abits-1 downto 0); DI : in std_logic_vector (dbits-1 downto 0); EN : in std_ulogic; CLK : in std_ulogic; WE : in std_ulogic; SSR : in std_ulogic); end component; component ram16_sx_sx generic (abits : integer := 10; dbits : integer := 8 ); port ( DOA : out std_logic_vector (dbits-1 downto 0); DOB : out std_logic_vector (dbits-1 downto 0); ADDRA : in std_logic_vector (abits-1 downto 0); CLKA : in std_ulogic; DIA : in std_logic_vector (dbits-1 downto 0); ENA : in std_ulogic; WEA : in std_ulogic; ADDRB : in std_logic_vector (abits-1 downto 0); CLKB : in std_ulogic; DIB : in std_logic_vector (dbits-1 downto 0); ENB : in std_ulogic; WEB : in std_ulogic); end component;end;-- simulation models for select-ramslibrary ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;entity ramb4_generic is generic ( abits : integer := 10; dbits : integer := 8 ); port (DI : in std_logic_vector (dbits-1 downto 0); EN : in std_ulogic; WE : in std_ulogic; RST : in std_ulogic; CLK : in std_ulogic; ADDR : in std_logic_vector (abits-1 downto 0); DO : out std_logic_vector (dbits-1 downto 0) );end; architecture behavioral of ramb4_generic is type mem is array(0 to (2**abits -1)) of std_logic_vector((dbits -1) downto 0);begin main : process(clk) variable memarr : mem; begin if rising_edge(clk)then if (en = '1') and not (is_x(addr)) then do <= memarr(to_integer(unsigned(addr))); end if; if (we and en) = '1' then if not is_x(addr) then memarr(to_integer(unsigned(addr))) := di; end if; end if; end if; end process;end;library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;entity ramb16_sx is generic ( abits : integer := 10; dbits : integer := 8 ); port ( DO : out std_logic_vector (dbits-1 downto 0); ADDR : in std_logic_vector (abits-1 downto 0); DI : in std_logic_vector (dbits-1 downto 0); EN : in std_ulogic; CLK : in std_ulogic; WE : in std_ulogic; SSR : in std_ulogic );end;architecture behav of ramb16_sx isbegin rp : process(clk) subtype dword is std_logic_vector(dbits-1 downto 0); type dregtype is array (0 to 2**abits -1) of DWord; variable rfd : dregtype; begin if rising_edge(clk) and not is_x (addr) then if en = '1' then do <= rfd(to_integer(unsigned(addr))); if we = '1' then rfd(to_integer(unsigned(addr))) := di; end if; end if; end if; end process;end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S16 is port ( do : out std_logic_vector (15 downto 0); addr : in std_logic_vector (7 downto 0); clk : in std_ulogic; di : in std_logic_vector (15 downto 0); en, rst, we : in std_ulogic);end;architecture behav of RAMB4_S16 isbegin x : ramb4_generic generic map (8,16) port map (di, en, we, rst, clk, addr, do); end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S8 is port (do : out std_logic_vector (7 downto 0); addr : in std_logic_vector (8 downto 0); clk : in std_ulogic; di : in std_logic_vector (7 downto 0); en, rst, we : in std_ulogic);end;architecture behav of RAMB4_S8 isbegin x : ramb4_generic generic map (9,8) port map (di, en, we, rst, clk, addr, do); end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S4 is port (do : out std_logic_vector (3 downto 0); addr : in std_logic_vector (9 downto 0); clk : in std_ulogic; di : in std_logic_vector (3 downto 0); en, rst, we : in std_ulogic);end;architecture behav of RAMB4_S4 isbegin x : ramb4_generic generic map (10,4) port map (di, en, we, rst, clk, addr, do); end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S2 is port (do : out std_logic_vector (1 downto 0); addr : in std_logic_vector (10 downto 0); clk : in std_ulogic; di : in std_logic_vector (1 downto 0); en, rst, we : in std_ulogic);end;architecture behav of RAMB4_S2 isbegin x : ramb4_generic generic map (11,2) port map (di, en, we, rst, clk, addr, do); end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S1 is port (do : out std_logic_vector (0 downto 0); addr : in std_logic_vector (11 downto 0); clk : in std_ulogic; di : in std_logic_vector (0 downto 0); en, rst, we : in std_ulogic);end;architecture behav of RAMB4_S1 isbegin x : ramb4_generic generic map (12,1) port map (di, en, we, rst, clk, addr, do); end;library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;entity RAMB4_SX_SX is generic (abits : integer := 10; dbits : integer := 8 ); port (DIA : in std_logic_vector (dbits-1 downto 0); DIB : in std_logic_vector (dbits-1 downto 0); ENA : in std_ulogic; ENB : in std_ulogic; WEA : in std_ulogic; WEB : in std_ulogic; RSTA : in std_ulogic; RSTB : in std_ulogic; CLKA : in std_ulogic; CLKB : in std_ulogic; ADDRA : in std_logic_vector (abits-1 downto 0); ADDRB : in std_logic_vector (abits-1 downto 0); DOA : out std_logic_vector (dbits-1 downto 0); DOB : out std_logic_vector (dbits-1 downto 0) );end;architecture behav of RAMB4_SX_SX isbegin rp : process(clka, clkb) subtype dword is std_logic_vector(dbits-1 downto 0); type dregtype is array (0 to 2**abits-1) of DWord; variable rfd : dregtype; begin if rising_edge(clka) and not is_x (addra) then if ena = '1' then doa <= rfd(to_integer(unsigned(addra))); if wea = '1' then rfd(to_integer(unsigned(addra))) := dia; end if; end if; end if; if rising_edge(clkb) and not is_x (addrb) then if enb = '1' then dob <= rfd(to_integer(unsigned(addrb))); if web = '1' then rfd(to_integer(unsigned(addrb))) := dib; end if; end if; end if; end process;end;library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S1_S1 is port ( doa : out std_logic_vector (0 downto 0); dob : out std_logic_vector (0 downto 0); addra : in std_logic_vector (11 downto 0); addrb : in std_logic_vector (11 downto 0); clka : in std_ulogic; clkb : in std_ulogic; dia : in std_logic_vector (0 downto 0); dib : in std_logic_vector (0 downto 0); ena : in std_ulogic; enb : in std_ulogic; rsta : in std_ulogic; rstb : in std_ulogic; wea : in std_ulogic; web : in std_ulogic );end;architecture behav of RAMB4_S1_S1 isbegin u0 : RAMB4_Sx_Sx generic map (12, 1) port map (DIA, DIB, ENA, ENB, WEA, WEB, RSTA, RSTB, CLKA, CLKB, ADDRA, ADDRB, DOA, DOB);end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S2_S2 is port ( doa : out std_logic_vector (1 downto 0); dob : out std_logic_vector (1 downto 0); addra : in std_logic_vector (10 downto 0); addrb : in std_logic_vector (10 downto 0); clka : in std_ulogic; clkb : in std_ulogic; dia : in std_logic_vector (1 downto 0); dib : in std_logic_vector (1 downto 0); ena : in std_ulogic; enb : in std_ulogic; rsta : in std_ulogic; rstb : in std_ulogic; wea : in std_ulogic; web : in std_ulogic );end;architecture behav of RAMB4_S2_S2 isbegin u0 : RAMB4_Sx_Sx generic map (11, 2) port map (DIA, DIB, ENA, ENB, WEA, WEB, RSTA, RSTB, CLKA, CLKB, ADDRA, ADDRB, DOA, DOB);end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S8_S8 is port ( doa : out std_logic_vector (7 downto 0); dob : out std_logic_vector (7 downto 0); addra : in std_logic_vector (8 downto 0); addrb : in std_logic_vector (8 downto 0); clka : in std_ulogic; clkb : in std_ulogic; dia : in std_logic_vector (7 downto 0); dib : in std_logic_vector (7 downto 0); ena : in std_ulogic; enb : in std_ulogic; rsta : in std_ulogic; rstb : in std_ulogic; wea : in std_ulogic; web : in std_ulogic );end;architecture behav of RAMB4_S8_S8 isbegin u0 : RAMB4_Sx_Sx generic map (9, 8) port map (DIA, DIB, ENA, ENB, WEA, WEB, RSTA, RSTB, CLKA, CLKB, ADDRA, ADDRB, DOA, DOB);end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S4_S4 is port ( doa : out std_logic_vector (3 downto 0); dob : out std_logic_vector (3 downto 0); addra : in std_logic_vector (9 downto 0); addrb : in std_logic_vector (9 downto 0); clka : in std_ulogic; clkb : in std_ulogic; dia : in std_logic_vector (3 downto 0); dib : in std_logic_vector (3 downto 0); ena : in std_ulogic; enb : in std_ulogic; rsta : in std_ulogic; rstb : in std_ulogic; wea : in std_ulogic; web : in std_ulogic );end;architecture behav of RAMB4_S4_S4 isbegin u0 : RAMB4_Sx_Sx generic map (4, 10) port map (DIA, DIB, ENA, ENB, WEA, WEB, RSTA, RSTB, CLKA, CLKB, ADDRA, ADDRB, DOA, DOB);end;library ieee;use ieee.std_logic_1164.all;library unisim;use unisim.simple_simprim.all;entity RAMB4_S16_S16 is port ( doa : out std_logic_vector (15 downto 0); dob : out std_logic_vector (15 downto 0); addra : in std_logic_vector (7 downto 0); addrb : in std_logic_vector (7 downto 0); clka : in std_ulogic;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -