📄 tech_virtex.vhd
字号:
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_S8_S8 is port (DIA : in std_logic_vector (7 downto 0); DIB : in std_logic_vector (7 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 (8 downto 0); ADDRB : in std_logic_vector (8 downto 0); DOA : out std_logic_vector (7 downto 0); DOB : out std_logic_vector (7 downto 0) );end;architecture behav of RAMB4_S8_S8 isbegin rp : process(clka, clkb) subtype dword is std_logic_vector(7 downto 0); type dregtype is array (0 to 511) 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_S4_S4 is port (DIA : in std_logic_vector (3 downto 0); DIB : in std_logic_vector (3 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 (9 downto 0); ADDRB : in std_logic_vector (9 downto 0); DOA : out std_logic_vector (3 downto 0); DOB : out std_logic_vector (3 downto 0) );end;architecture behav of RAMB4_S4_S4 isbegin rp : process(clka, clkb) subtype dword is std_logic_vector(3 downto 0); type dregtype is array (0 to 1023) 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_S16_S16 is port (DIA : in std_logic_vector (15 downto 0); DIB : in std_logic_vector (15 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 (7 downto 0); ADDRB : in std_logic_vector (7 downto 0); DOA : out std_logic_vector (15 downto 0); DOB : out std_logic_vector (15 downto 0) );end;architecture behav of RAMB4_S16_S16 isbegin rp : process(clka, clkb) subtype dword is std_logic_vector(15 downto 0); type dregtype is array (0 to 255) 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;entity IBUF_PCI33_3 is port (O : out std_ulogic; I : in std_ulogic); end;architecture beh of IBUF_PCI33_3 is begin O <= to_X01(I) after 2 ns; end;LIBRARY ieee;use IEEE.std_logic_1164.all;entity OBUF_PCI33_3 is port (O : out std_ulogic; I : in std_ulogic);end;architecture beh of OBUF_PCI33_3 is begin O <= I after 7 ns; end;LIBRARY ieee;use IEEE.std_logic_1164.all;entity IOBUF_PCI33_3 is port (O : out std_ulogic; IO : inout std_logic; I, T : in std_ulogic); end;architecture beh of IOBUF_PCI33_3 is begin O <= to_X01(IO) after 2 ns; IO <= I after 7 ns when T = '0' else 'Z' after 7 ns; end;LIBRARY ieee;use IEEE.std_logic_1164.all;entity OBUFT_PCI33_3 is port (O : out std_ulogic; I, T : in std_ulogic); end;architecture beh of OBUFT_PCI33_3 is begin O <= I after 7 ns when T = '0' else 'Z' after 7 ns; end;-- pragma translate_on-- package with virtex select-ram component declarationslibrary IEEE;use IEEE.std_logic_1164.all;package virtex_complib is component RAMB4_S16 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 component; component RAMB4_S8 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 component; component RAMB4_S4 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 component; component RAMB4_S2 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 component; component RAMB4_S1 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 component; component RAMB4_S1_S1 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 component; component RAMB4_S2_S2 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 component; component RAMB4_S4_S4 port (DIA : in std_logic_vector (3 downto 0); DIB : in std_logic_vector (3 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 (9 downto 0); ADDRB : in std_logic_vector (9 downto 0); DOA : out std_logic_vector (3 downto 0); DOB : out std_logic_vector (3 downto 0) ); end component; component RAMB4_S8_S8 port (DIA : in std_logic_vector (7 downto 0); DIB : in std_logic_vector (7 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 (8 downto 0); ADDRB : in std_logic_vector (8 downto 0); DOA : out std_logic_vector (7 downto 0); DOB : out std_logic_vector (7 downto 0) ); end component; component RAMB4_S16_S16 port (DIA : in std_logic_vector (15 downto 0); DIB : in std_logic_vector (15 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 (7 downto 0); ADDRB : in std_logic_vector (7 downto 0); DOA : out std_logic_vector (15 downto 0); DOB : out std_logic_vector (15 downto 0) ); end component; component IBUF_PCI33_3 port (O : out std_ulogic; I : in std_ulogic); end component; component OBUF_PCI33_3 port (O : out std_ulogic; I : in std_ulogic); end component; component IOBUF_PCI33_3 port (O : out std_ulogic; IO : inout std_logic; I, T : in std_ulogic); end component; component OBUFT_PCI33_3 port (O : out std_ulogic; I, T : in std_ulogic); end component;end;-- parametrisable sync ram generator using virtex select rams-- max size: 4096x128 bitsLIBRARY ieee;use IEEE.std_logic_1164.all;use work.virtex_complib.all;entity virtex_syncram is generic ( abits : integer := 8; dbits : integer := 32); 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;architecture behav of virtex_syncram issignal gnd : std_logic;signal do, di : std_logic_vector(129 downto 0);signal xa, ya : std_logic_vector(19 downto 0);begin gnd <= '0'; dataout <= do(dbits-1 downto 0); di(dbits-1 downto 0) <= datain; di(129 downto dbits) <= (others => '0'); xa(abits-1 downto 0) <= address; xa(19 downto abits) <= (others => '0'); ya(abits-1 downto 0) <= address; ya(19 downto abits) <= (others => '1'); a7 : if (abits <= 7) and (dbits <= 32) generate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -