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

📄 tech_generic.vhd

📁 ARM7的源代码
💻 VHD
📖 第 1 页 / 共 2 页
字号:
------------------------------------------------------------------------------  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_generic-- File:	tech_generic.vhd-- Author:	Jiri Gaisler - ESA/ESTEC-- Description:	Contains behavioural pads and ram generators------------------------------------------------------------------------------LIBRARY ieee;use IEEE.std_logic_1164.all;use work.leon_iface.all;package tech_generic is-- generic sync ramcomponent generic_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 generic_regfile_iu  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 generic_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;-- bypass logic for async-read/sync-write regfilescomponent rfbypass  generic (    abits : integer := 8;    dbits : integer := 32  );  port (    clk   : in clk_type;    write : in std_logic;    datain: in std_logic_vector (dbits -1 downto 0);    raddr1: in std_logic_vector (abits -1 downto 0);    raddr2: in std_logic_vector (abits -1 downto 0);    waddr : in std_logic_vector (abits -1 downto 0);    q1    : in std_logic_vector (dbits -1 downto 0);    q2    : in std_logic_vector (dbits -1 downto 0);    dataout1 : out std_logic_vector (dbits -1 downto 0);    dataout2 : out std_logic_vector (dbits -1 downto 0)  );end component;-- generic multiplercomponent generic_smult  generic ( abits : integer := 10; bbits : integer := 8 );  port (    a    : in  std_logic_vector(abits-1 downto 0);    b    : in  std_logic_vector(bbits-1 downto 0);    c    : out std_logic_vector(abits+bbits-1 downto 0)  ); end component; -- generic clock generatorcomponent generic_clkgen 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 generic_dpram_as   generic (    abits : integer := 8;    dbits : integer := 32;    words : integer := 256  );  port (    clk : in std_logic;    rdaddress: in std_logic_vector (abits -1 downto 0);    wraddress: in std_logic_vector (abits -1 downto 0);    data: in std_logic_vector (dbits -1 downto 0);    wren : in std_logic;    q: out std_logic_vector (dbits -1 downto 0)  );end component;component generic_dpram_ss   generic (    abits : integer := 8;    dbits : integer := 32;    words : integer := 256  );  port (    clk : in std_logic;    rdaddress: in std_logic_vector (abits -1 downto 0);    wraddress: in std_logic_vector (abits -1 downto 0);    data: in std_logic_vector (dbits -1 downto 0);    wren : in std_logic;    q: out std_logic_vector (dbits -1 downto 0)  );end component;-- padscomponent geninpad port (pad : in std_logic; q : out std_logic); end component; component gensmpad port (pad : in std_logic; q : out std_logic); end component;component genoutpad port (d : in  std_logic; pad : out  std_logic); end component; component gentoutpadu port (d, en : in std_logic; pad : out std_logic); end component;component geniopad   port ( d, en : in std_logic; q : out std_logic; pad : inout std_logic);end component;component geniodpad   port ( d : in std_logic; q : out std_logic; pad : inout std_logic);end component;component genodpad port ( d : in std_logic; pad : out std_logic); end component;end;library IEEE;use IEEE.std_logic_1164.all;-------------------------------------------------------------------- behavioural ram models ---------------------------------------------------------------------------------------------------------------- synchronous ram for direct interference library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use work.leon_iface.all;entity generic_syncram is  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;     architecture behavioral of generic_syncram is  type mem is array(0 to (2**abits -1)) 	of std_logic_vector((dbits -1) downto 0);  signal memarr : mem;  signal ra  : std_logic_vector((abits -1) downto 0);  attribute syn_ramstyle : string;  attribute syn_ramstyle of memarr: signal is "block_ram";-- pragma translate_off  signal rw : std_logic;-- pragma translate_onbegin  main : process(clk, memarr, ra)  begin    if rising_edge(clk) then      if write = '1' then-- pragma translate_off        if not is_x(address) then-- pragma translate_on          memarr(conv_integer(unsigned(address))) <= datain;-- pragma translate_off        end if;-- pragma translate_on      end if;      ra <= address;-- pragma translate_off      rw <= write;-- pragma translate_on    end if;  end process;-- pragma translate_off  readport : process(memarr, ra, rw)  begin    if not (is_x(ra) or (rw = '1')) then-- pragma translate_on      dataout <= memarr(conv_integer(unsigned(ra)));-- pragma translate_off    else      dataout <= (others => 'X');    end if;  end process;-- pragma translate_onend;-- synchronous dpram for direct instantiation LIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use work.leon_iface.all;entity generic_dpram_ss is  generic (    abits : integer := 8;    dbits : integer := 32;    words : integer := 256  );  port (    clk : in std_logic;    rdaddress: in std_logic_vector (abits -1 downto 0);    wraddress: in std_logic_vector (abits -1 downto 0);    data: in std_logic_vector (dbits -1 downto 0);    wren : in std_logic;    q: out std_logic_vector (dbits -1 downto 0)  );end;architecture behav of generic_dpram_ss is  type dregtype is array (0 to words - 1) 	of std_logic_vector(dbits -1 downto 0);  signal rfd : dregtype;  signal wa, ra : std_logic_vector (abits -1 downto 0);  attribute syn_ramstyle : string;  attribute syn_ramstyle of rfd: signal is "block_ram";-- pragma translate_off  signal drivex : boolean;-- pragma translate_onbegin  rp : process(clk)  begin    if rising_edge(clk) then      if wren = '1' then-- pragma translate_off	if not ( is_x(wraddress) or 	    (conv_integer(unsigned(wraddress)) >= words))	then-- pragma translate_on   	  rfd(conv_integer(unsigned(wraddress))) <= data; -- pragma translate_off        end if;-- pragma translate_on      end if;-- pragma translate_off      drivex <= (wren = '1') and (wraddress = rdaddress);-- pragma translate_on      ra <= rdaddress;    end if;  end process;-- pragma translate_off  readport : process(rfd, ra, drivex)  begin    if not (is_x(ra) or (conv_integer(unsigned(ra)) >= words) or drivex)     then-- pragma translate_on      q <= rfd(conv_integer(unsigned(ra)));-- pragma translate_off    else      q <= (others => 'X');    end if;  end process;-- pragma translate_onend;-- async dpram for direct instantiation LIBRARY ieee;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use work.leon_iface.all;entity generic_dpram_as is  generic (    abits : integer := 8;    dbits : integer := 32;    words : integer := 256  );  port (    clk : in std_logic;    rdaddress: in std_logic_vector (abits -1 downto 0);    wraddress: in std_logic_vector (abits -1 downto 0);    data: in std_logic_vector (dbits -1 downto 0);    wren : in std_logic;    q: out std_logic_vector (dbits -1 downto 0)  );end;architecture behav of generic_dpram_as is  type dregtype is array (0 to words - 1)        of std_logic_vector(dbits -1 downto 0);  signal rfd : dregtype;  signal wa : std_logic_vector (abits -1 downto 0);  attribute syn_ramstyle : string;  attribute syn_ramstyle of rfd: signal is "block_ram";begin  rp : process(clk)  begin    if rising_edge(clk) then      if wren = '1' then-- pragma translate_off	if not ( is_x(wraddress) or 	    (conv_integer(unsigned(wraddress)) >= words))	then-- pragma translate_on   	  rfd(conv_integer(unsigned(wraddress))) <= data; -- pragma translate_off        end if;-- pragma translate_on      end if;--     wa <= wraddress;    end if;  end process;

⌨️ 快捷键说明

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