📄 tech_atc18.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_atc18-- File: tech_atc18.vhd-- Author: Jiri Gaisler - Gaisler Research-- Description: Contains Atmel ATC18 specific pads and ram generators------------------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_atc18 is-- sync ram generator component atc18_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 atc18_regfile_iu generic (rftype : integer := 1; abits : integer := 8; dbits : integer := 32; words : integer := 136); 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 atc18_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 atc18_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;-- input pads, all others pads are taken from the atc25 package component atc18_inpad port (pad : in std_logic; q : out std_logic); end component; component atc18_smpad port (pad : in std_logic; q : out 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 pc33d00 is port (pad : in std_logic; cin : out std_logic); end; architecture rtl of pc33d00 is begin cin <= to_x01(pad) after 1 ns; end;-- input schmitt padlibrary IEEE;use IEEE.std_logic_1164.all;entity pc33d20 is port (pad : in std_logic; cin : out std_logic); end; architecture rtl of pc33d20 is begin cin <= to_x01(pad) after 1 ns; end;-------------------------------------------------------------------- behavioural ram models ------------------------------------------------------------------------------------------------------------ synchronous 1-port ramlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity atc18_syncram_sim is generic ( abits : integer := 10; dbits : integer := 8 ); port ( addr : in std_logic_vector((abits -1) downto 0); clk : in std_logic; di : in std_logic_vector((dbits -1) downto 0); do : out std_logic_vector((dbits -1) downto 0); me : in std_logic; oe : in std_logic; we : in std_logic ); end;architecture behavioral of atc18_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(clk, oe, me) variable memarr : mem; variable doint : std_logic_vector((dbits -1) downto 0); begin if rising_edge(clk) and (me = '1') and not is_x(addr) then if (we = '1') then memarr(conv_integer(unsigned(addr))) := di; end if; doint := memarr(conv_integer(unsigned(addr))); end if; if (me and oe) = '1' then do <= doint; else do <= (others => 'Z'); end if; end process;end behavioral;-- synchronous 2-port ramLIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;entity atc18_2pram_sim is generic ( abits : integer := 10; dbits : integer := 8; words : integer := 1024 ); port ( addra, addrb : in std_logic_vector((abits -1) downto 0); clka, clkb : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); dob : out std_logic_vector((dbits -1) downto 0); mea, wea, meb, oeb : in std_logic ); end;architecture behavioral of atc18_2pram_sim is subtype word is std_logic_vector((dbits -1) downto 0); type mem is array(0 to (words-1)) of word;begin main : process(clka, clkb, oeb, mea, meb, wea) variable memarr : mem; variable doint : std_logic_vector((dbits -1) downto 0); begin if rising_edge(clka) and (mea = '1') and not is_x(addra) then if (wea = '1') then memarr(conv_integer(unsigned(addra)) mod words) := dia; end if; end if; if rising_edge(clkb) and (meb = '1') and not is_x(addrb) then doint := memarr(conv_integer(unsigned(addrb)) mod words); end if; if (meb and oeb) = '1' then dob <= doint; else dob <= (others => 'Z'); end if; end process;end behavioral;-- synchronous dual-port ramLIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;entity atc18_dpram_sim is generic ( abits : integer := 10; dbits : integer := 8 ); port ( addra : in std_logic_vector((abits -1) downto 0); clka : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); doa : out std_logic_vector((dbits -1) downto 0); mea, oea, 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); dob : out std_logic_vector((dbits -1) downto 0); meb, oeb, web : in std_logic ); end;architecture behavioral of atc18_dpram_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(clka, oea, mea, clkb, oeb, meb) variable memarr : mem; variable dointa, dointb : std_logic_vector((dbits -1) downto 0); begin if rising_edge(clka) and (mea = '1') and not is_x(addra) then if (wea = '1') then memarr(conv_integer(unsigned(addra))) := dia; end if; dointa := memarr(conv_integer(unsigned(addra))); end if; if (mea and oea) = '1' then doa <= dointa; else doa <= (others => 'Z'); end if; if rising_edge(clkb) and (meb = '1') and not is_x(addrb) then if (web = '1') then memarr(conv_integer(unsigned(addrb))) := dib; end if; dointb := memarr(conv_integer(unsigned(addrb))); end if; if (meb and oeb) = '1' then dob <= dointb; else dob <= (others => 'Z'); end if; end process;end behavioral;-- package with common ram simulation modelsLIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_atc18_sim iscomponent atc18_syncram_sim generic ( abits : integer := 10; dbits : integer := 8 ); port ( addr : in std_logic_vector((abits -1) downto 0); clk : in std_logic; di : in std_logic_vector((dbits -1) downto 0); do : out std_logic_vector((dbits -1) downto 0); me : in std_logic; oe : in std_logic; we : in std_logic ); end component;-- synchronous 2-port ramcomponent atc18_2pram_sim generic ( abits : integer := 8; dbits : integer := 32; words : integer := 256 ); port ( addra, addrb : in std_logic_vector((abits -1) downto 0); clka, clkb : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); dob : out std_logic_vector((dbits -1) downto 0); mea, wea, meb, oeb : in std_logic );end component;component atc18_dpram_sim generic ( abits : integer := 8; dbits : integer := 32 ); port ( addra : in std_logic_vector((abits -1) downto 0); clka : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); doa : out std_logic_vector((dbits -1) downto 0); mea, oea, 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); dob : out std_logic_vector((dbits -1) downto 0); meb, oeb, web : in std_logic );end component;end;-- 1-port syncronous ramlibrary ieee;use IEEE.std_logic_1164.all;use work.tech_atc18_sim.all;entity hdss1_128x32cm4sw0 is port ( addr, taddr : in std_logic_vector(6 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(31 downto 0); do : out std_logic_vector(31 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic );end;architecture behavioral of hdss1_128x32cm4sw0 isbegin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -