📄 tech_virtex2.vhd
字号:
------------------------------------------------------------------------------ This file is a part of the LEON VHDL model-- Copyright (C) 2003 Gaisler Research---- This library is free software; you can redistribute it and/or-- modify it under the terms of the GNU Lesser 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.LGPL for the full details of the license.------------------------------------------------------------------------------- Package: tech_virtex2-- File: tech_virtex2.vhd-- Author: Jiri Gaisler - Gaisler Research-- Author: Richard Pender - Pender Electronic Design-- Description: Xilinx Virtex2 specific regfile and cache ram generators------------------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_virtex2 iscomponent virtex2_syncram generic ( abits : integer := 10; dbits : integer := 8 ); port ( address : in std_logic_vector((abits -1) downto 0); clk : in std_logic; datain : in std_logic_vector((dbits -1) downto 0); dataout : out std_logic_vector((dbits -1) downto 0); enable : in std_logic; write : in std_logic ); end component;-- three-port regfile with sync read, sync write component virtex2_regfile generic ( rftype : integer := 1; abits : integer := 8; dbits : integer := 32; words : integer := 128 ); port ( rst : in std_logic; clk : in std_logic; clkn : in std_logic; rfi : in rf_in_type; rfo : out rf_out_type); end component; component virtex2_regfile_cp generic ( abits : integer := 4; dbits : integer := 32; words : integer := 16 ); port ( rst : in std_logic; clk : in std_logic; rfi : in rf_cp_in_type; rfo : out rf_cp_out_type); end component;component virtex2_dpram generic ( abits : integer := 10; dbits : integer := 8 ); port ( address1 : in std_logic_vector((abits -1) downto 0); clk1 : in std_logic; datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_logic; write1 : in std_logic; address2 : in std_logic_vector((abits -1) downto 0); clk2 : in std_logic; datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_logic; write2 : in std_logic ); end component;component virtex2_clkgen generic ( clk_mul : integer := 1 ; clk_div : integer := 1); port ( clkin : in std_logic; pciclkin: in std_logic; clk : out std_logic; -- main clock clkn : out std_logic; -- inverted main clock sdclk : out std_logic; -- SDRAM clock pciclk : out std_logic; -- PCI clock cgi : in clkgen_in_type; cgo : out clkgen_out_type );end component; end;-- package with virtex select-ram component declarationslibrary IEEE;use IEEE.std_logic_1164.all;package virtex2_complib is component RAMB16_S1 port ( DO : out std_logic_vector (0 downto 0); ADDR : in std_logic_vector (13 downto 0); DI : in std_logic_vector (0 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end component;component RAMB16_S2 port ( DO : out std_logic_vector (1 downto 0); ADDR : in std_logic_vector (12 downto 0); DI : in std_logic_vector (1 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end component;component RAMB16_S4 port ( DO : out std_logic_vector (3 downto 0); ADDR : in std_logic_vector (11 downto 0); DI : in std_logic_vector (3 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end component;component RAMB16_S9 port ( DO : out std_logic_vector (7 downto 0); DOP : out std_logic_vector (0 downto 0); ADDR : in std_logic_vector (10 downto 0); DI : in std_logic_vector (7 downto 0); DIP : in std_logic_vector (0 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end component; component RAMB16_S18 port ( DO : out std_logic_vector (15 downto 0); DOP : out std_logic_vector (1 downto 0); ADDR : in std_logic_vector (9 downto 0); DI : in std_logic_vector (15 downto 0); DIP : in std_logic_vector (1 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end component;component RAMB16_S36 port ( DO : out std_logic_vector (31 downto 0); DOP : out std_logic_vector (3 downto 0); ADDR : in std_logic_vector (8 downto 0); DI : in std_logic_vector (31 downto 0); DIP : in std_logic_vector (3 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end component;component RAMB16_S4_S4 port ( DOA : out std_logic_vector (3 downto 0); DOB : out std_logic_vector (3 downto 0); ADDRA : in std_logic_vector (11 downto 0); CLKA : in std_logic; DIA : in std_logic_vector (3 downto 0); ENA : in std_logic; SSRA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (11 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (3 downto 0); ENB : in std_logic; SSRB : in std_logic; WEB : in std_logic );end component;component RAMB16_S9_S9 port ( DOA : out std_logic_vector (7 downto 0); DOPA : out std_logic_vector (0 downto 0); DOB : out std_logic_vector (7 downto 0); DOPB : out std_logic_vector (0 downto 0); ADDRA : in std_logic_vector (10 downto 0); CLKA : in std_logic; DIA : in std_logic_vector (7 downto 0); DIPA : in std_logic_vector (0 downto 0); ENA : in std_logic; SSRA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (10 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (7 downto 0); DIPB : in std_logic_vector (0 downto 0); ENB : in std_logic; SSRB : in std_logic; WEB : in std_logic );end component;component RAMB16_S18_S18 port ( DOA : out std_logic_vector (15 downto 0); DOPA : out std_logic_vector (1 downto 0); DOB : out std_logic_vector (15 downto 0); DOPB : out std_logic_vector (1 downto 0); ADDRA : in std_logic_vector (9 downto 0); CLKA : in std_logic; DIA : in std_logic_vector (15 downto 0); DIPA : in std_logic_vector (1 downto 0); ENA : in std_logic; SSRA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (9 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (15 downto 0); DIPB : in std_logic_vector (1 downto 0); ENB : in std_logic; SSRB : in std_logic; WEB : in std_logic );end component;component RAMB16_S36_S36 port ( DOA : out std_logic_vector (31 downto 0); DOPA : out std_logic_vector (3 downto 0); DOB : out std_logic_vector (31 downto 0); DOPB : out std_logic_vector (3 downto 0); ADDRA : in std_logic_vector (8 downto 0); CLKA : in std_logic; DIA : in std_logic_vector (31 downto 0); DIPA : in std_logic_vector (3 downto 0); ENA : in std_logic; SSRA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (8 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (31 downto 0); DIPB : in std_logic_vector (3 downto 0); ENB : in std_logic; SSRB : in std_logic; WEB : in std_logic );end component;-- pragma translate_offcomponent 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_logic; DIA : in std_logic_vector (dbits-1 downto 0); ENA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (abits-1 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (dbits-1 downto 0); ENB : in std_logic; WEB : in std_logic );end component;-- pragma translate_onend;-- pragma translate_off-- simulation models for select-ramsLIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB16_S1 is port ( DO : out std_logic_vector (0 downto 0); ADDR : in std_logic_vector (13 downto 0); DI : in std_logic_vector (0 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end;architecture behav of RAMB16_S1 isbegin x : generic_syncram generic map (14,1) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB16_S2 is port ( DO : out std_logic_vector (1 downto 0); ADDR : in std_logic_vector (12 downto 0); DI : in std_logic_vector (1 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end;architecture behav of RAMB16_S2 isbegin x : generic_syncram generic map (13,2) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB16_S4 is port ( DO : out std_logic_vector (3 downto 0); ADDR : in std_logic_vector (11 downto 0); DI : in std_logic_vector (3 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end;architecture behav of RAMB16_S4 isbegin x : generic_syncram generic map (12,4) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB16_S9 is port ( DO : out std_logic_vector (7 downto 0); DOP : out std_logic_vector (0 downto 0); ADDR : in std_logic_vector (10 downto 0); DI : in std_logic_vector (7 downto 0); DIP : in std_logic_vector (0 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end;architecture behav of RAMB16_S9 issignal dix, dox : std_logic_vector (8 downto 0);begin x : generic_syncram generic map (11,9) port map (addr, clk, dix, dox, en, we); dix <= dip & di; dop <= dox(8 downto 8); do <= dox(7 downto 0);end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB16_S18 is port ( DO : out std_logic_vector (15 downto 0); DOP : out std_logic_vector (1 downto 0); ADDR : in std_logic_vector (9 downto 0); DI : in std_logic_vector (15 downto 0); DIP : in std_logic_vector (1 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end;architecture behav of RAMB16_S18 issignal dix, dox : std_logic_vector (17 downto 0);begin x : generic_syncram generic map (10,18) port map (addr, clk, dix, dox, en, we); dix <= dip & di; dop <= dox(17 downto 16); do <= dox(15 downto 0);end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB16_S36 is port ( DO : out std_logic_vector (31 downto 0); DOP : out std_logic_vector (3 downto 0); ADDR : in std_logic_vector (8 downto 0); DI : in std_logic_vector (31 downto 0); DIP : in std_logic_vector (3 downto 0); EN : in std_logic; CLK : in std_logic; WE : in std_logic; SSR : in std_logic );end;architecture behav of RAMB16_S36 issignal dix, dox : std_logic_vector (35 downto 0);begin x : generic_syncram generic map (9, 36) port map (addr, clk, dix, dox, en, we); dix <= dip & di; dop <= dox(35 downto 32); do <= dox(31 downto 0);end;LIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;entity ram16_sx_sx is 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_logic; DIA : in std_logic_vector (dbits-1 downto 0); ENA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (abits-1 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (dbits-1 downto 0); ENB : in std_logic; WEB : in std_logic );end;architecture behav of ram16_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(conv_integer(unsigned(addra))); if wea = '1' then rfd(conv_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(conv_integer(unsigned(addrb))); if web = '1' then rfd(conv_integer(unsigned(addrb))) := dib; end if; end if; end if; end process;end;LIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use work.virtex2_complib.all;entity RAMB16_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 (11 downto 0); CLKA : in std_logic; DIA : in std_logic_vector (3 downto 0); ENA : in std_logic; SSRA : in std_logic; WEA : in std_logic; ADDRB : in std_logic_vector (11 downto 0); CLKB : in std_logic; DIB : in std_logic_vector (3 downto 0); ENB : in std_logic; SSRB : in std_logic; WEB : in std_logic );end;architecture behav of RAMB16_S4_S4 isbegin x : ram16_sx_sx generic map (12, 4) port map (doa, dob, addra, clka, dia, ena, wea, addrb, clkb, dib, enb, web);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -