📄 tech_virtex.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_virtex-- File: tech_virtex.vhd-- Author: Jiri Gaisler - Gaisler Research-- Description: Xilinx Virtex specific regfile and cache ram generators------------------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_virtex iscomponent virtex_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 virtex_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 virtex_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 virtex_bprom port ( clk : in std_logic; addr : in std_logic_vector(29 downto 0); data : out std_logic_vector(31 downto 0) ); end component;component virtex_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 virtex_clkgengeneric ( 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;component virtex_pciinpad port (q : out std_ulogic; pad : in std_logic); end component; component virtex_pcitoutpad port (d, en : in std_logic; pad : out std_logic); end component; component virtex_pcioutpad port (d : in std_logic; pad : out std_logic); end component; component virtex_pciiopad port (d, en : in std_logic; q : out std_ulogic; pad : inout std_logic); end component; component virtex_pciiodpad port (d : in std_logic; q : out std_ulogic; pad : inout std_logic); end component; end;-- xilinx pre-loaded cache-- pragma translate_off-- boot promlibrary IEEE;use IEEE.std_logic_1164.all;entity virtex_prom256 is port ( addr: in std_logic_vector(7 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end;library IEEE;use IEEE.std_logic_1164.all;entity virtex_prom512 is port ( addr: in std_logic_vector(8 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end;library IEEE;use IEEE.std_logic_1164.all;entity virtex_prom1024 is port ( addr: in std_logic_vector(9 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end;library IEEE;use IEEE.std_logic_1164.all;entity virtex_prom2048 is port ( addr: in std_logic_vector(10 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end;-- pragma translate_onlibrary IEEE;use IEEE.std_logic_1164.all;use work.leon_config.all;entity virtex_bprom is port ( clk : in std_logic; addr : in std_logic_vector(29 downto 0); data : out std_logic_vector(31 downto 0) );end;architecture rtl of virtex_bprom iscomponent virtex_prom256 port ( addr: in std_logic_vector(7 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end component;component virtex_prom512 port ( addr: in std_logic_vector(8 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end component;component virtex_prom1024 port ( addr: in std_logic_vector(9 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end component;component virtex_prom2048 port ( addr: in std_logic_vector(10 downto 0); clk : in std_logic; do : out std_logic_vector(31 downto 0));end component;begin p256 : if PABITS = 8 generate dt0 : virtex_prom256 port map ( addr => addr(7 downto 0), clk => clk, do => data(31 downto 0)); end generate; p512 : if PABITS = 9 generate dt0 : virtex_prom512 port map ( addr => addr(8 downto 0), clk => clk, do => data(31 downto 0)); end generate; p1024 : if PABITS = 10 generate dt0 : virtex_prom1024 port map ( addr => addr(9 downto 0), clk => clk, do => data(31 downto 0)); end generate; p2048 : if PABITS = 11 generate dt0 : virtex_prom2048 port map ( addr => addr(10 downto 0), clk => clk, do => data(31 downto 0)); end generate;end;-- pragma translate_off-- simulation models for select-ramsLIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB4_S16 is port (DI : in std_logic_vector (15 downto 0); EN : in std_logic; WE : in std_logic; RST : in std_logic; CLK : in std_logic; ADDR : in std_logic_vector (7 downto 0); DO : out std_logic_vector (15 downto 0) );end;architecture behav of RAMB4_S16 isbegin x : generic_syncram generic map (8,16) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB4_S8 is port (DI : in std_logic_vector (7 downto 0); EN : in std_logic; WE : in std_logic; RST : in std_logic; CLK : in std_logic; ADDR : in std_logic_vector (8 downto 0); DO : out std_logic_vector (7 downto 0) );end;architecture behav of RAMB4_S8 isbegin x : generic_syncram generic map (9,8) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB4_S4 is port (DI : in std_logic_vector (3 downto 0); EN : in std_logic; WE : in std_logic; RST : in std_logic; CLK : in std_logic; ADDR : in std_logic_vector (9 downto 0); DO : out std_logic_vector (3 downto 0) );end;architecture behav of RAMB4_S4 isbegin x : generic_syncram generic map (10,4) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB4_S2 is port (DI : in std_logic_vector (1 downto 0); EN : in std_logic; WE : in std_logic; RST : in std_logic; CLK : in std_logic; ADDR : in std_logic_vector (10 downto 0); DO : out std_logic_vector (1 downto 0) );end;architecture behav of RAMB4_S2 isbegin x : generic_syncram generic map (11,2) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use work.tech_generic.all;entity RAMB4_S1 is port (DI : in std_logic_vector (0 downto 0); EN : in std_logic; WE : in std_logic; RST : in std_logic; CLK : in std_logic; ADDR : in std_logic_vector (11 downto 0); DO : out std_logic_vector (0 downto 0) );end;architecture behav of RAMB4_S1 isbegin x : generic_syncram generic map (12,1) port map (addr, clk, di, do, en, we); end;LIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use work.tech_generic.all;entity RAMB4_S1_S1 is port (DIA : in std_logic_vector (0 downto 0); DIB : in std_logic_vector (0 downto 0); ENA : in std_logic; ENB : in std_logic; WEA : in std_logic; WEB : in std_logic; RSTA : in std_logic; RSTB : in std_logic; CLKA : in std_logic; CLKB : in std_logic; ADDRA : in std_logic_vector (11 downto 0); ADDRB : in std_logic_vector (11 downto 0); DOA : out std_logic_vector (0 downto 0); DOB : out std_logic_vector (0 downto 0) );end;architecture behav of RAMB4_S1_S1 isbegin rp : process(clka, clkb) subtype dword is std_logic_vector(0 downto 0); type dregtype is array (0 to 4095) 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.tech_generic.all;entity RAMB4_S2_S2 is port (DIA : in std_logic_vector (1 downto 0); DIB : in std_logic_vector (1 downto 0); ENA : in std_logic; ENB : in std_logic; WEA : in std_logic; WEB : in std_logic; RSTA : in std_logic; RSTB : in std_logic; CLKA : in std_logic; CLKB : in std_logic; ADDRA : in std_logic_vector (10 downto 0); ADDRB : in std_logic_vector (10 downto 0); DOA : out std_logic_vector (1 downto 0); DOB : out std_logic_vector (1 downto 0) );end;architecture behav of RAMB4_S2_S2 isbegin rp : process(clka, clkb) subtype dword is std_logic_vector(1 downto 0); type dregtype is array (0 to 2047) of DWord; variable rfd : dregtype; begin if rising_edge(clka) and not is_x (addra) then if ena = '1' then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -