⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tech_tsmc25.vhd

📁 ARM7的源代码
💻 VHD
📖 第 1 页 / 共 5 页
字号:
------------------------------------------------------------------------------  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_tsmc25-- File:        tech_tsmc25.vhd-- Author:      Jiri Gaisler - Gaisler Research-- Author:      Daniel Mok - Institute for Communications Research-- Description: Contains TSMC 0.25um process specific pads and ram generators--              from Artisan libraries (http: --              ------------------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_tsmc25 is-- sync ram generatorcomponent tsmc25_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;-- regfile generatorcomponent tsmc25_regfile_iu  generic ( 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 tsmc25_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 tsmc25_dpram  generic ( abits : integer := 10; dbits : integer := 8 );  port (    address1 : in std_logic_vector((abits -1) downto 0);    clk      : 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);    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; -- pads  component tsmc25_inpad     port (pad : in std_logic; q : out std_logic);  end component;   component tsmc25_smpad    port (pad : in std_logic; q : out std_logic);  end component;  component tsmc25_outpad    generic (drive : integer := 2);    port (d : in  std_logic; pad : out  std_logic);  end component;   component tsmc25_toutpadu    generic (drive : integer := 2);    port (d, en : in  std_logic; pad : out  std_logic);  end component;   component tsmc25_iopad    generic (drive : integer := 2);    port ( d, en : in std_logic; q : out std_logic; pad : inout std_logic);  end component;  component tsmc25_iodpad     generic (drive : integer := 2);    port ( d : in std_logic; q : out std_logic; pad : inout std_logic);  end component;  component tsmc25_odpad    generic (drive : integer := 2);    port ( d : in std_logic; pad : out std_logic);  end component;  component tsmc25_smiopad    generic (drive : integer := 2);    port ( d, en : in std_logic; q : out std_logic; pad : inout std_logic);  end component;end;-------------------------------------------------------------------- Behavioural models only needed for simulation, not synthesis.-------------------------------------------------------------------- synopsys translate_off-------------------------------------------------------------------- behavioural ram models ------------------------------------------------------------------------------------------------------------ Synchronous SRAM simulation modellibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity tsmc25_syncram_ss is  generic ( abits : integer := 10; dbits : integer := 8 );  port (    CLK: in std_logic;    CEN: in std_logic;    WEN: in std_logic_vector(3 downto 0);    A:  in  std_logic_vector((abits -1) downto 0);    D:  in  std_logic_vector((dbits -1) downto 0);    Q:  out std_logic_vector((dbits -1) downto 0)  ); end;     architecture behavioral of tsmc25_syncram_ss is  subtype word is std_logic_vector((dbits -1) downto 0);  type mem is array(0 to (2**abits -1)) of word;beging0:if dbits = 32 generate  main : process(CLK)  variable memarr : mem;  begin    if rising_edge(CLK) and (CEN = '0') then      if not is_x(A) then        if WEN(0) = '0' then          memarr(conv_integer(unsigned(A)))(7 downto 0) := D(7 downto 0);        end if;        if WEN(1) = '0' then          memarr(conv_integer(unsigned(A)))(15 downto 8) := D(15 downto 8);        end if;        if WEN(2) = '0' then          memarr(conv_integer(unsigned(A)))(23 downto 16) := D(23 downto 16);        end if;        if WEN(3) = '0' then          memarr(conv_integer(unsigned(A)))(31 downto 24) := D(31 downto 24);        end if;        Q <= memarr(conv_integer(unsigned(A)));      else        Q <= (others => 'Z');      end if;    end if;  end process;  end generate;g1:if dbits /= 32 generate  main : process(CLK)  variable memarr : mem;  begin    if rising_edge(CLK) and (CEN = '0') then      if not is_x(A) then        if WEN(0) = '0' then          memarr(conv_integer(unsigned(A))) := D;        end if;        Q <= memarr(conv_integer(unsigned(A)));      else        Q <= (others => 'Z');      end if;    end if;  end process;  end generate;end behavioral;-- Synchronous DPRAM simulation modelLIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;entity tsmc25_dpram_ss is  generic (    abits : integer := 8;    dbits : integer := 32;    words : integer := 256  );  port (    CLKA: in std_logic;    CENA: in std_logic;    WENA: in std_logic;    AA: in std_logic_vector (abits -1 downto 0);    DA: in std_logic_vector (dbits -1 downto 0);    QA: out std_logic_vector (dbits -1 downto 0);    CLKB: in std_logic;    CENB: in std_logic;    WENB: in std_logic;    AB: in std_logic_vector (abits -1 downto 0);    DB: in std_logic_vector (dbits -1 downto 0);    QB: out std_logic_vector (dbits -1 downto 0)  );end;architecture behav of tsmc25_dpram_ss is  signal writea : std_logic := '0';  signal writeb : std_logic := '0';  signal reada  : std_logic := '0';  signal readb  : std_logic := '0';  subtype word is std_logic_vector((dbits -1) downto 0);  type mem is array(0 to words-1) of word;  constant t_cc : time := 2 ns;  -- clock collision time  constant t_ac : time := 3 ns;  -- access time  begin  portA : process(CLKA,CLKB)  variable memarr : mem;  variable last_addr: std_logic_vector (abits -1 downto 0);  begin    if rising_edge(CLKA) and (CENA = '0') then      if not is_x(AA) then        if writeb = '1'  and last_addr = AA then          if WENA = '0' then  -- write-write collision            memarr(conv_integer(unsigned(AA))) := (others => 'X');            QA <= DA  after t_ac;            writea <= '1', '0' after t_cc;          else            QA <= (others => 'X'); -- write-read collision          end if;        else          if WENA = '0' then            memarr(conv_integer(unsigned(AA))) := DA;            writea <= '1', '0' after t_cc;            if readb = '1' and last_addr = AA then              QB <= (others => 'X');  -- read-write collision            end if;          else            reada <= '1', '0' after t_cc;          end if;          last_addr := AA;          QA <= memarr(conv_integer(unsigned(AA))) after t_ac;        end if;      else        QA <= (others => 'X');      end if;    end if;    if rising_edge(CLKB) and (CENB = '0') then      if not is_x(AB) then        if writea = '1' and last_addr = AA then           if WENB = '0' then   -- write-write collision            memarr(conv_integer(unsigned(AB))) := (others => 'X');            QB <= DB after t_ac;            writeb <= '1', '0' after t_cc;          else            QB <= (others => 'X'); -- write-read collision          end if;        else          if WENB = '0' then            memarr(conv_integer(unsigned(AB))) := DB;            writeb <= '1', '0' after t_cc;            if reada = '1' and last_addr = AB then              QA <= (others => 'X');  -- read-write collision            end if;          else            readb <= '1', '0' after t_cc;          end if;          last_addr := AB;          QB <= memarr(conv_integer(unsigned(AB))) after t_ac;        end if;      else        QB <= (others => 'X');      end if;    end if;  end process;end behav;------------------------------------------------------------- syncronous tsmc25 sram simulation model package -------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;package tech_tsmc25_sim iscomponent tsmc25_syncram_ss  generic ( abits : integer := 10; dbits : integer := 8 );  port (  CLK: in std_logic;  CEN: in std_logic;  WEN: in std_logic_vector(3 downto 0);  A: in std_logic_vector((abits -1) downto 0);  D: in std_logic_vector((dbits -1) downto 0);  Q: out std_logic_vector((dbits -1) downto 0)  ); end component;     component tsmc25_dpram_ss  generic (    abits : integer := 8;    dbits : integer := 32;    words : integer := 256  );  port (   CLKA: in std_logic;   CENA: in std_logic;   WENA: in std_logic;   AA: in std_logic_vector (abits -1 downto 0);   DA: in std_logic_vector (dbits -1 downto 0);   QA: out std_logic_vector (dbits -1 downto 0);   CLKB: in std_logic;   CENB: in std_logic;   WENB: in std_logic;   AB: in std_logic_vector (abits -1 downto 0);   DB: in std_logic_vector (dbits -1 downto 0);   QB: out std_logic_vector (dbits -1 downto 0)  );end component;end;-----------------------------------------------------------library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram16384x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic;   A: in std_logic_vector(13 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram16384x32 issignal wen_s: std_logic_vector(3 downto 0);begin  wen_s(0) <= wen;  wen_s(1) <= wen;  wen_s(2) <= wen;  wen_s(3) <= wen;  syncram0 : tsmc25_syncram_ss    generic map ( abits => 14, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => wen_s,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram8192x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic;   A: in std_logic_vector(12 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram8192x32 issignal wen_s: std_logic_vector(3 downto 0);begin  wen_s(0) <= wen;  wen_s(1) <= wen;  wen_s(2) <= wen;  wen_s(3) <= wen;  syncram0 : tsmc25_syncram_ss    generic map ( abits => 13, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => wen_s,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram4096x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic_vector(3 downto 0);   A: in std_logic_vector(11 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram4096x32 isbegin  syncram0 : tsmc25_syncram_ss    generic map ( abits => 12, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => WEN,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram2400x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic;   A: in std_logic_vector(11 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram2400x32 issignal wen_s: std_logic_vector(3 downto 0);begin  wen_s(0) <= wen;  wen_s(1) <= wen;  wen_s(2) <= wen;  wen_s(3) <= wen;  syncram0 : tsmc25_syncram_ss    generic map ( abits => 12, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => wen_s,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram2048x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic_vector(3 downto 0);   A: in std_logic_vector(10 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram2048x32 isbegin  syncram0 : tsmc25_syncram_ss    generic map ( abits => 11, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => WEN,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram1024x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic_vector(3 downto 0);   A: in std_logic_vector(9 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram1024x32 isbegin  syncram0 : tsmc25_syncram_ss    generic map ( abits => 10, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => WEN,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram512x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic;   A: in std_logic_vector(8 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram512x32 issignal wen_s: std_logic_vector(3 downto 0);begin  wen_s(0) <= wen;  wen_s(1) <= wen;  wen_s(2) <= wen;  wen_s(3) <= wen;  syncram0 : tsmc25_syncram_ss    generic map ( abits => 9, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => wen_s,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram256x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic;   A: in std_logic_vector(7 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram256x32 issignal wen_s: std_logic_vector(3 downto 0);begin  wen_s(0) <= wen;  wen_s(1) <= wen;  wen_s(2) <= wen;  wen_s(3) <= wen;  syncram0 : tsmc25_syncram_ss    generic map ( abits => 8, dbits => 32)    port map (     CLK => CLK,    CEN => CEN,    WEN => wen_s,    A   => A,    D   => D,    Q   => Q    ); end behavioral;library ieee;use IEEE.std_logic_1164.all;use work.tech_tsmc25_sim.all;entity ram128x32 is   port (    CLK: in std_logic;   CEN: in std_logic;   WEN: in std_logic;   A: in std_logic_vector(6 downto 0);   D: in std_logic_vector(31 downto 0);   Q: out std_logic_vector(31 downto 0)   );end;architecture behavioral of ram128x32 issignal wen_s: std_logic_vector(3 downto 0);begin  wen_s(0) <= wen;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -