📄 tech_atc25.vhd
字号:
------------------------------------------------------------------------------ This file is a part of the LEON VHDL model-- Copyright (C) 1999 European Space Agency (ESA)---- 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.------------------------------------------------------------------------------- Entity: tech_atc25-- File: tech_atc25.vhd-- Author: Jiri Gaisler - Gaisler Research-- Description: Contains Atmel ATC25 specific pads and ram generators------------------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_atc25 is-- sync ram generator component atc25_syncram generic ( abits : integer := 10; dbits : integer := 8 ); port ( address : in std_logic_vector(abits -1 downto 0); clk : in clk_type; 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;-- IU regfile generatorcomponent atc25_regfile_iu generic (rftype : integer := 1; abits : integer := 8; dbits : integer := 32; words : integer := 128); port ( rst : in std_logic; clk : in clk_type; clkn : in clk_type; rfi : in rf_in_type; rfo : out rf_out_type); end component;component atc25_regfile_cp generic ( abits : integer := 4; dbits : integer := 32; words : integer := 16 ); port ( rst : in std_logic; clk : in clk_type; rfi : in rf_cp_in_type; rfo : out rf_cp_out_type);end component;component atc25_dpram generic ( abits : integer := 10; dbits : integer := 8 ); port ( address1 : in std_logic_vector((abits -1) downto 0); clk : in clk_type; 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); 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;-- standard pads component atc25_inpad port (pad : in std_logic; q : out std_logic); end component; component atc25_smpad port (pad : in std_logic; q : out std_logic); end component; component atc25_outpad generic (drive : integer := 1); port (d : in std_logic; pad : out std_logic); end component; component atc25_toutpad generic (drive : integer := 1); port (d, en : in std_logic; pad : out std_logic); end component; component atc25_toutpadu generic (drive : integer := 1); port (d, en : in std_logic; pad : out std_logic); end component; component atc25_iopad generic (drive : integer := 1); port ( d, en : in std_logic; q : out std_logic; pad : inout std_logic); end component; component atc25_iopadu generic (drive : integer := 1); port ( d, en : in std_logic; q : out std_logic; pad : inout std_logic); end component; component atc25_iodpad generic (drive : integer := 1); port ( d : in std_logic; q : out std_logic; pad : inout std_logic); end component; component atc25_odpad generic (drive : integer := 1); port ( d : in std_logic; pad : out std_logic); end component;-- PCI pads component atc25_pcioutpad port (d : in std_logic; pad : out std_logic); end component; component atc25_pcitoutpad port (d, en : in std_logic; pad : out std_logic); end component; component atc25_pciiopad port ( d, en : in std_logic; q : out std_logic; pad : inout std_logic); end component; component atc25_pciiodpad port ( d : in std_logic; q : out std_logic; pad : inout std_logic); end component;end;-------------------------------------------------------------------- behavioural pad models ---------------------------------------------------------------------------------------------------------------- Only needed for simulation, not synthesis.-- pragma translate_off-- input padlibrary IEEE;use IEEE.std_logic_1164.all;entity pt33d00 is port (pad : in std_logic; cin : out std_logic); end; architecture rtl of pt33d00 is begin cin <= to_x01(pad) after 1 ns; end;-- input pad with pull-uplibrary IEEE;use IEEE.std_logic_1164.all;entity pt33d00u is port (pad : inout std_logic; cin : out std_logic); end; architecture rtl of pt33d00u is begin cin <= to_x01(pad) after 1 ns; pad <= 'H'; end;-- input schmitt padlibrary IEEE;use IEEE.std_logic_1164.all;entity pt33d20 is port (pad : in std_logic; cin : out std_logic); end; architecture rtl of pt33d20 is begin cin <= to_x01(pad) after 1 ns; end;-- input schmitt pad with pull-uplibrary IEEE;use IEEE.std_logic_1164.all;entity pt33d20u is port (pad : inout std_logic; cin : out std_logic); end; architecture rtl of pt33d20u is begin cin <= to_x01(pad) after 1 ns; pad <= 'H'; end;-- output padslibrary IEEE; use IEEE.std_logic_1164.all;entity pt33o01 is port (i : in std_logic; pad : out std_logic); end; architecture rtl of pt33o01 is begin pad <= to_x01(i) after 2 ns; end;library IEEE; use IEEE.std_logic_1164.all;entity pt33o02 is port (i : in std_logic; pad : out std_logic); end; architecture rtl of pt33o02 is begin pad <= to_x01(i) after 2 ns; end;library IEEE; use IEEE.std_logic_1164.all;entity pt33o03 is port (i : in std_logic; pad : out std_logic); end; architecture rtl of pt33o03 is begin pad <= to_x01(i) after 2 ns; end;library IEEE; use IEEE.std_logic_1164.all;entity pt33o04 is port (i : in std_logic; pad : out std_logic); end; architecture rtl of pt33o04 is begin pad <= to_x01(i) after 2 ns; end;-- output tri-state pads with pull-uplibrary IEEE; use IEEE.std_logic_1164.all;entity pt33t01u is port (i, oen : in std_logic; pad : out std_logic); end; architecture rtl of pt33t01u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; end; library IEEE; use IEEE.std_logic_1164.all;entity pt33t02u is port (i, oen : in std_logic; pad : out std_logic); end; architecture rtl of pt33t02u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; end; library IEEE; use IEEE.std_logic_1164.all;entity pt33t03u is port (i, oen : in std_logic; pad : out std_logic); end; architecture rtl of pt33t03u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; end; -- bidirectional padlibrary IEEE; use IEEE.std_logic_1164.all;entity pt33b01 is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b01 isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'Z' after 2 ns; cin <= to_x01(pad) after 1 ns;end;library IEEE;use IEEE.std_logic_1164.all;entity pt33b02 is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b02 isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'Z' after 2 ns; cin <= to_x01(pad) after 1 ns;end;library IEEE;use IEEE.std_logic_1164.all;entity pt33b03 is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b03 isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'Z' after 2 ns; cin <= to_x01(pad) after 1 ns;end;library IEEE;use IEEE.std_logic_1164.all;entity pt33b04 is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b04 isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'Z' after 2 ns; cin <= to_x01(pad) after 1 ns;end;-- bidirectional pads with pull-uplibrary IEEE;use IEEE.std_logic_1164.all;entity pt33b01u is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b01u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; cin <= to_x01(pad) after 1 ns;end;library IEEE;use IEEE.std_logic_1164.all;entity pt33b02u is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b02u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; cin <= to_x01(pad) after 1 ns;end;library IEEE;use IEEE.std_logic_1164.all;entity pt33b03u is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b03u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; cin <= to_x01(pad) after 1 ns;end;library IEEE;use IEEE.std_logic_1164.all;entity pt33b04u is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pt33b04u isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'H' after 2 ns; cin <= to_x01(pad) after 1 ns;end;-- PCI output padlibrary IEEE; use IEEE.std_logic_1164.all;entity pp33o01 is port (i : in std_logic; pad : out std_logic); end; architecture rtl of pp33o01 is begin pad <= to_x01(i) after 2 ns; end;-- PCI bidirectional padlibrary IEEE; use IEEE.std_logic_1164.all;entity pp33b015vt is port ( i, oen : in std_logic; cin : out std_logic; pad : inout std_logic);end; architecture rtl of pp33b015vt isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'Z' after 2 ns; cin <= to_x01(pad) after 1 ns;end;-- PCI output tri-state padlibrary IEEE; use IEEE.std_logic_1164.all;entity pp33t015vt is port (i, oen : in std_logic; pad : out std_logic); end; architecture rtl of pp33t015vt isbegin pad <= to_x01(i) after 2 ns when oen = '0' else 'Z' after 2 ns; end; -------------------------------------------------------------------- behavioural ram models ------------------------------------------------------------------------------------------------------------ clocked address + control, unlatched datalibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity atc25_syncram_sim is generic ( abits : integer := 10; dbits : integer := 8 ); port ( a : in std_logic_vector((abits -1) downto 0); ce : in std_logic; i : in std_logic_vector((dbits -1) downto 0); o : out std_logic_vector((dbits -1) downto 0); csb : in std_logic; web : in std_logic; oeb : in std_logic ); end;architecture behavioral of atc25_syncram_sim is subtype word is std_logic_vector((dbits -1) downto 0); type mem is array(0 to (2**abits -1)) of word;begin main : process(ce) variable memarr : mem; begin if rising_edge(ce) and (csb = '0') and not is_x(a) then if oeb = '0' then o <= memarr(conv_integer(unsigned(a))); else o <= (others => 'Z'); end if; if (web = '0') then memarr(conv_integer(unsigned(a))) := i; end if; end if; end process;end behavioral;-- Asynchronous 2-port ramLIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;entity atc25_2pram is generic ( abits : integer := 8; dbits : integer := 32; words : integer := 256 ); port ( ra : in std_logic_vector (abits -1 downto 0); wa : in std_logic_vector (abits -1 downto 0); di : in std_logic_vector (dbits -1 downto 0); do : out std_logic_vector (dbits -1 downto 0); re : in std_logic; oe : in std_logic; we : in std_logic );end;architecture behav of atc25_2pram issignal d1 : std_logic_vector (dbits -1 downto 0);signal ra1, wa1 : std_logic_vector (abits -1 downto 0);begin d1 <= di after 1 ns; ra1 <= ra after 1 ns; wa1 <= wa after 1 ns; rp : process(wa1, ra1, d1, re, oe, we) subtype dword is std_logic_vector(dbits -1 downto 0); type dregtype is array (0 to words - 1) of DWord; variable rfd : dregtype; begin if is_x(we) or ((we = '0') and is_x(wa1)) then for i in 0 to words -1 loop rfd(i) := (others => 'X'); end loop; elsif (we = '0') then rfd(conv_integer(unsigned(wa1)) mod words) := d1; end if; if (oe or re) = '0' then if not is_x (ra1) then do <= rfd(conv_integer(unsigned(ra1)) mod words); else do <= (others => 'X'); end if; else do <= (others => 'Z'); end if; end process;end;-- Asynchronous dual-port ramLIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;entity atc25_dpram_sim is generic ( abits : integer := 8; dbits : integer := 32; words : integer := 256 ); port ( a1 : in std_logic_vector (abits -1 downto 0); a2 : in std_logic_vector (abits -1 downto 0); di1 : in std_logic_vector (dbits -1 downto 0); di2 : in std_logic_vector (dbits -1 downto 0); do1 : out std_logic_vector (dbits -1 downto 0); do2 : out std_logic_vector (dbits -1 downto 0); re1 : in std_logic; re2 : in std_logic; oe1 : in std_logic; oe2 : in std_logic; we1 : in std_logic; we2 : in std_logic );end;architecture behav of atc25_dpram_sim issignal d1, d2 : std_logic_vector (dbits -1 downto 0);signal aa1, aa2 : std_logic_vector (abits -1 downto 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -