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

📄 leon3mp.vhd

📁 This leon3 design is tailored to the Altera NiosII Startix2 Development board, with 16-bit DDR SDR
💻 VHD
📖 第 1 页 / 共 2 页
字号:
--------------------------------------------------------------------------------  LEON3 Demonstration design--  Copyright (C) 2004 Jiri Gaisler, Gaisler Research----  This program is free software; you can redistribute it and/or modify--  it under the terms of the GNU General Public License as published by--  the Free Software Foundation; either version 2 of the License, or--  (at your option) any later version.----  This program is distributed in the hope that it will be useful,--  but WITHOUT ANY WARRANTY; without even the implied warranty of--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the--  GNU General Public License for more details.----  You should have received a copy of the GNU General Public License--  along with this program; if not, write to the Free Software--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAlibrary ieee;use ieee.std_logic_1164.all;library grlib;use grlib.amba.all;use grlib.stdlib.all;library techmap;use techmap.gencomp.all;library gaisler;use gaisler.memctrl.all;use gaisler.leon3.all;use gaisler.uart.all;use gaisler.misc.all;use gaisler.net.all;use gaisler.ata.all;use gaisler.jtag.all;library esa;use esa.memoryctrl.all;use work.config.all;entity leon3mp is  generic (    fabtech : integer := CFG_FABTECH;    memtech : integer := CFG_MEMTECH;    padtech : integer := CFG_PADTECH;    clktech : integer := CFG_CLKTECH;    ncpu    : integer := CFG_NCPU;    disas   : integer := CFG_DISAS;     -- Enable disassembly to console    dbguart : integer := CFG_DUART;     -- Print UART on console    pclow   : integer := CFG_PCLOW;    freq    : integer := 50000         -- frequency of main clock (used for PLLs)    );  port (    resetn  : in  std_ulogic;    clk     : in  std_ulogic;    errorn  : out   std_ulogic;    -- flash/ethernet bus    address : out   std_logic_vector(23 downto 0);    data    : inout std_logic_vector(31 downto 0);    romsn   : out std_ulogic;    oen     : out std_logic;    writen  : out std_logic;    byten   : out std_logic;    wpn     : out std_logic;    -- SSRAM    ssram_cen  	: out std_logic;    ssram_wen 	: out std_logic;    ssram_bw   	: out std_logic_vector (0 to 3);    ssram_oen   : out std_ulogic;    ssaddr      : out std_logic_vector(20 downto 2);    ssdata      : inout std_logic_vector(31 downto 0);    ssram_clk  	: out std_ulogic;    ssram_adscn : out std_ulogic;    ssram_adsp_n : out std_ulogic;    ssram_adv_n : out std_ulogic;-- pragma translate_off    iosn    : out   std_ulogic;-- pragma translate_on    ddr_clkin  	: in  std_logic;    ddr_clk  	: out std_logic;    ddr_clkn  	: out std_logic;    ddr_cke  	: out std_logic;    ddr_csb  	: out std_logic;    ddr_web  	: out std_ulogic;                       -- ddr write enable    ddr_rasb  	: out std_ulogic;                       -- ddr ras    ddr_casb  	: out std_ulogic;                       -- ddr cas    ddr_dm   	: out std_logic_vector (1 downto 0);    -- ddr dm    ddr_dqs  	: inout std_logic_vector (1 downto 0);  -- ddr dqs    ddr_ad      : out std_logic_vector (12 downto 0);   -- ddr address    ddr_ba      : out std_logic_vector (1 downto 0);    -- ddr bank address    ddr_dq  	: inout std_logic_vector (15 downto 0); -- ddr data    -- debug support unit    dsubren             : in  std_ulogic;    dsuact              : out std_ulogic;    -- console/debug UART    rxd1 : in  std_logic;    txd1 : out std_logic;    -- ATA signals    ata_data  : inout std_logic_vector(15 downto 0);    ata_da    : out std_logic_vector(2 downto 0);      ata_cs0   : out std_logic;    ata_cs1   : out std_logic;    ata_dior  : out std_logic;    ata_diow  : out std_logic;    ata_iordy : in std_logic;    ata_intrq : in std_logic;    ata_dmack : out std_logic;        -- Signals nedded to use CompactFlash with ATA controller    cf_power   : out std_logic; -- To turn on power to the CompactFlash     cf_gnd_da  : out std_logic_vector(10 downto 3); -- grounded address lines    cf_atasel  : out std_logic; -- grounded to select true IDE mode    cf_we      : out std_logic; -- should be connected to VCC in true IDE mode--    cf_csel    : out std_logic;        -- for smsc lan chip    eth_aen   : out std_logic;     eth_readn : out std_logic;     eth_writen: out std_logic;     eth_nbe   : out std_logic_vector(3 downto 0);        eth_lclk     : out std_ulogic;    eth_nads     : out std_logic;    eth_ncycle   : out std_logic;    eth_wnr      : out std_logic;    eth_nvlbus   : out std_logic;    eth_nrdyrtn  : out std_logic;    eth_ndatacs  : out std_logic;    gpio         : inout std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0) 	-- I/O port    );end;architecture rtl of leon3mp is    constant blength   : integer := 12;  constant fifodepth : integer := 8;  constant maxahbm : integer := NCPU+CFG_AHB_UART+CFG_AHB_JTAG;  signal vcc, gnd    : std_logic_vector(7 downto 0);  signal memi, smemi : memory_in_type;  signal memo, smemo : memory_out_type;  signal wpo         : wprot_out_type;    signal ddsi  : ddrmem_in_type;  signal ddso  : ddrmem_out_type;  signal ddrclkfb, ssrclkfb, ddr_clkl, ddr_clk90l, ddr_clknl, ddr_clk270l : std_ulogic;  signal ddr_clkv 	: std_logic_vector(2 downto 0);  signal ddr_clkbv	: std_logic_vector(2 downto 0);  signal ddr_ckev  	: std_logic_vector(1 downto 0);  signal ddr_csbv  	: std_logic_vector(1 downto 0);  signal ddr_adl      	: std_logic_vector (13 downto 0);  signal clklock, lock, clkml, rst, ndsuact : std_ulogic;  signal tck, tckn, tms, tdi, tdo : std_ulogic;  signal ddrclk, ddrrst : std_ulogic;--  attribute syn_keep : boolean;--  attribute syn_preserve : boolean;--  attribute syn_keep of clkml : signal is true;--  attribute syn_preserve of clkml : signal is true;  --for smc lan chip  signal s_eth_aen   : std_logic;   signal s_eth_readn : std_logic;   signal s_eth_writen: std_logic;   signal s_eth_nbe   : std_logic_vector(3 downto 0);  signal ssd, prd    : std_logic_vector(31 downto 0);  signal apbi  : apb_slv_in_type;  signal apbo  : apb_slv_out_vector := (others => apb_none);  signal ahbsi : ahb_slv_in_type;  signal ahbso : ahb_slv_out_vector := (others => ahbs_none);  signal ahbmi : ahb_mst_in_type;  signal ahbmo : ahb_mst_out_vector := (others => ahbm_none);  signal clkm, rstn, ssram_clkl : std_ulogic;  signal cgi                : clkgen_in_type;  signal cgo                : clkgen_out_type;  signal u1i, dui           : uart_in_type;  signal u1o, duo           : uart_out_type;  signal irqi : irq_in_vector(0 to NCPU-1);  signal irqo : irq_out_vector(0 to NCPU-1);  signal dbgi : l3_debug_in_vector(0 to NCPU-1);  signal dbgo : l3_debug_out_vector(0 to NCPU-1);  signal dsui : dsu_in_type;  signal dsuo : dsu_out_type;  signal ata : ata_type;  signal cf  : cf_out_type;  signal gpti : gptimer_in_type;  signal gpioi : gpio_in_type;  signal gpioo : gpio_out_type;  constant IOAEN : integer := 1;  constant BOARD_FREQ : integer := 50000;   -- input frequency in KHz  constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV;  -- cpu frequency in KHz  signal lclk, lclkout  : std_ulogic;    signal dsubre : std_ulogic;  component smc_mctrl  generic (    hindex    : integer := 0;    pindex    : integer := 0;    romaddr   : integer := 16#000#;    rommask   : integer := 16#E00#;    ioaddr    : integer := 16#200#;    iomask    : integer := 16#E00#;    ramaddr   : integer := 16#400#;    rammask   : integer := 16#C00#;    paddr     : integer := 0;    pmask     : integer := 16#fff#;    wprot     : integer := 0;    invclk    : integer := 0;     fast      : integer := 0;     romasel   : integer := 28;    sdrasel   : integer := 29;    srbanks   : integer := 4;    ram8      : integer := 0;    ram16     : integer := 0;    sden      : integer := 0;    sepbus    : integer := 0;    sdbits    : integer := 32;    sdlsb     : integer := 2;    oepol     : integer := 0;    syncrst   : integer := 0  );  port (    rst       : in  std_ulogic;    clk       : in  std_ulogic;    memi      : in  memory_in_type;    memo      : out memory_out_type;    ahbsi     : in  ahb_slv_in_type;    ahbso     : out ahb_slv_out_type;    apbi      : in  apb_slv_in_type;    apbo      : out apb_slv_out_type;    wpo       : in  wprot_out_type;    sdo       : out sdram_out_type;    eth_aen   : out std_ulogic; -- for smsc lan chip    eth_readn : out std_ulogic; -- for smsc lan chip    eth_writen: out std_ulogic;  -- for smsc lan chip    eth_nbe   : out std_logic_vector(3 downto 0) -- for smsc lan chip  );  end component; begin-------------------------------------------------------------------------  Reset and Clock generation  -----------------------------------------------------------------------------------------------------------  vcc <= (others => '1'); gnd <= (others => '0');  cgi.pllctrl <= "00"; cgi.pllrst <= not resetn; cgi.pllref <= clk;   clklock <=  cgo.clklock and lock;  clk_pad : clkpad generic map (tech => padtech) port map (clk, lclk);  clkgen0 : clkgen  -- clock generator using toplevel generic 'freq'    generic map (tech => CFG_CLKTECH, clk_mul => CFG_CLKMUL,                 clk_div => CFG_CLKDIV, sdramen => CFG_MCTRL_SDEN,                 freq => freq)    port map (clkin => lclk, pciclkin => gnd(0), clk => clkm, clkn => open,              clk2x => open, sdclk => ssram_clkl, pciclk => open,              cgi => cgi, cgo => cgo);  ssrclk_pad : outpad generic map (tech => padtech, slew => 1, strength => 24) 	port map (ssram_clk, ssram_clkl);    rst0 : rstgen                         -- reset generator    port map (resetn, clkm, clklock, rstn);---------------------------------------------------------------------- ---  AHB CONTROLLER ------------------------------------------------------------------------------------------------------------------------  ahb0 : ahbctrl 		-- AHB arbiter/multiplexer  generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, 	rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,	ioen => IOAEN, nahbm => maxahbm, nahbs => 8)  port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);-------------------------------------------------------------------------  LEON3 processor and DSU ---------------------------------------------------------------------------------------------------------------  l3 : if CFG_LEON3 = 1 generate    cpu : for i in 0 to NCPU-1 generate      u0 : leon3s                         -- LEON3 processor

⌨️ 快捷键说明

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