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

📄 mmu.vhd

📁 leon3 source code 虽然gaisler网站上有下载
💻 VHD
📖 第 1 页 / 共 2 页
字号:
--------------------------------------------------------------------------------  This file is a part of the GRLIB VHDL IP LIBRARY--  Copyright (C) 2003, 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  USA ------------------------------------------------------------------------------- Entity: 	MMU-- File:	mmu.vhd-- Author:	Konrad Eisele, Jiri Gaisler, Gaisler Research-- Description:	Leon3 MMU top level entity------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library grlib;use grlib.stdlib.all;library techmap;use techmap.gencomp.all;library gaisler;use gaisler.mmuconfig.all;use gaisler.mmuiface.all;use gaisler.libmmu.all;entity mmu is  generic (    tech      : integer range 0 to NTECH := 0;    itlbnum   : integer range 2 to 64 := 8;    dtlbnum   : integer range 2 to 64 := 8;    tlb_type  : integer range 0 to 3 := 1;    tlb_rep   : integer range 0 to 1 := 0    );  port (    rst  : in std_logic;    clk  : in std_logic;        mmudci : in  mmudc_in_type;    mmudco : out mmudc_out_type;    mmuici : in  mmuic_in_type;    mmuico : out mmuic_out_type;        mcmmo  : in  memory_mm_out_type;    mcmmi  : out memory_mm_in_type    );end mmu;architecture rtl of mmu isconstant MMUCTX_BITS 	: integer := M_CTX_SZ;constant M_TLB_TYPE     : integer range 0 to 1 := conv_integer(conv_std_logic_vector(tlb_type,2) and conv_std_logic_vector(1,2));  -- eather split or combinedconstant M_TLB_FASTWRITE : integer range 0 to 3 := conv_integer(conv_std_logic_vector(tlb_type,2) and conv_std_logic_vector(2,2));   -- fast writebufferconstant M_ENT_I        : integer range 2 to 64 := itlbnum;   -- icache tlb entries: numberconstant M_ENT_ILOG     : integer := log2(M_ENT_I);     -- icache tlb entries: address bitsconstant M_ENT_D        : integer range 2 to 64 := dtlbnum;   -- dcache tlb entries: numberconstant M_ENT_DLOG     : integer := log2(M_ENT_D);     -- dcache tlb entries: address bitsconstant M_ENT_C        : integer range 2 to 64 := M_ENT_I;   -- i/dcache tlb entries: numberconstant M_ENT_CLOG     : integer := M_ENT_ILOG;     -- i/dcache tlb entries: address bits    type mmu_op is record    trans_op  : std_logic;    flush_op  : std_logic;    diag_op   : std_logic;  end record;    type mmu_cmbpctrl is record    tlbowner     : mmu_idcache;    tlbactive    : std_logic;    op           : mmu_op;  end record;  type mmu_rtype is record    cmb_s1          : mmu_cmbpctrl;     cmb_s2          : mmu_cmbpctrl;          splt_is1          : mmu_cmbpctrl;    splt_is2          : mmu_cmbpctrl;    splt_ds1          : mmu_cmbpctrl;    splt_ds2          : mmu_cmbpctrl;          twactive     : std_logic;        -- split tlb    twowner      : mmu_idcache;        -- split tlb    flush         : std_logic;    mmctrl2       : mmctrl_type2;  end record;  signal r, c   : mmu_rtype;    -- tlb  component mmutlb    generic (       tech     : integer range 0 to NTECH := 0;      entries  : integer range 2 to 32 := 8;      tlb_type  : integer range 0 to 3 := 1;      tlb_rep   : integer range 0 to 1 := 0      );    port (      rst   : in std_logic;      clk   : in std_logic;      tlbi  : in mmutlb_in_type;      tlbo  : out mmutlb_out_type;      two  : in mmutw_out_type;      twi  : out mmutw_in_type      );  end component;  signal tlbi_a0 : mmutlb_in_type;  signal tlbi_a1 : mmutlb_in_type;  signal tlbo_a0 : mmutlb_out_type;  signal tlbo_a1 : mmutlb_out_type;  signal twi_a : mmutwi_a(1 downto 0);  signal two_a : mmutwo_a(1 downto 0);  -- table walk  component mmutw   port (    rst     : in  std_logic;    clk     : in  std_logic;    mmctrl1 : in  mmctrl_type1;    twi     : in  mmutw_in_type;    two     : out mmutw_out_type;    mcmmo   : in  memory_mm_out_type;    mcmmi   : out memory_mm_in_type    );  end component;  signal twi     : mmutw_in_type;  signal two     : mmutw_out_type;  signal mmctrl1 : mmctrl_type1;    begin        p1: process (clk)  begin if rising_edge(clk) then r <= c; end if;  end process p1;    p0: process (rst, r, c, mmudci, mmuici, mcmmo, tlbo_a0, tlbo_a1, tlbi_a0, tlbi_a1, two_a, twi_a, two)    variable cmbtlbin     : mmuidc_data_in_type;    variable cmbtlbout    : mmutlb_out_type;        variable spltitlbin     : mmuidc_data_in_type;    variable spltdtlbin     : mmuidc_data_in_type;    variable spltitlbout    : mmutlb_out_type;    variable spltdtlbout    : mmutlb_out_type;                variable mmuico_transdata : mmuidc_data_out_type;    variable mmudco_transdata : mmuidc_data_out_type;    variable mmuico_grant : std_logic;    variable mmudco_grant : std_logic;    variable v            : mmu_rtype;    variable twiv         : mmutw_in_type;    variable twod, twoi   : mmutw_out_type;    variable fault       : mmutlbfault_out_type;    variable wbtransdata : mmuidc_data_out_type;        variable fs : mmctrl_fs_type;    variable fa : std_logic_vector(VA_I_SZ-1 downto 0);  begin         v := r;    wbtransdata.finish := '0';    wbtransdata.data   := (others => '0');    wbtransdata.cache  := '0';    wbtransdata.accexc := '0';    if (M_TLB_TYPE = 0) and (M_TLB_FASTWRITE /= 0) then      wbtransdata := tlbo_a1.wbtransdata;    end if;        cmbtlbin.data := (others => '0');    cmbtlbin.su := '0';    cmbtlbin.read := '0';    cmbtlbin.isid := id_dcache;        cmbtlbout.transdata.finish := '0';    cmbtlbout.transdata.data := (others => '0');    cmbtlbout.transdata.cache := '0';    cmbtlbout.transdata.accexc := '0';        cmbtlbout.fault.fault_pro := '0';    cmbtlbout.fault.fault_pri := '0';    cmbtlbout.fault.fault_access := '0';    cmbtlbout.fault.fault_mexc := '0';    cmbtlbout.fault.fault_trans := '0';    cmbtlbout.fault.fault_inv := '0';    cmbtlbout.fault.fault_lvl := (others => '0');    cmbtlbout.fault.fault_su  := '0';    cmbtlbout.fault.fault_read := '0';    cmbtlbout.fault.fault_isid  := id_dcache;    cmbtlbout.fault.fault_addr := (others => '0');    cmbtlbout.nexttrans := '0';    cmbtlbout.s1finished := '0';        mmuico_transdata.finish := '0';    mmuico_transdata.data := (others => '0');    mmuico_transdata.cache := '0';    mmuico_transdata.accexc := '0';    mmudco_transdata.finish := '0';    mmudco_transdata.data := (others => '0');    mmudco_transdata.cache := '0';    mmudco_transdata.accexc := '0';        mmuico_grant := '0';    mmudco_grant := '0';    twiv.walk_op_ur := '0';    twiv.areq_ur := '0';        twiv.data := (others => '0');    twiv.adata := (others => '0');    twiv.aaddr := (others => '0');        twod.finish := '0';    twod.data := (others => '0');    twod.addr := (others => '0');    twod.lvl := (others => '0');    twod.fault_mexc := '0';    twod.fault_trans := '0';    twod.fault_inv := '0';    twod.fault_lvl := (others => '0');    twoi.finish := '0';    twoi.data := (others => '0');    twoi.addr := (others => '0');    twoi.lvl := (others => '0');    twoi.fault_mexc := '0';    twoi.fault_trans := '0';    twoi.fault_inv := '0';    twoi.fault_lvl := (others => '0');        fault.fault_pro := '0';    fault.fault_pri := '0';    fault.fault_access := '0';    fault.fault_mexc := '0';    fault.fault_trans := '0';    fault.fault_inv := '0';    fault.fault_lvl := (others => '0');    fault.fault_su := '0';    fault.fault_read := '0';    fault.fault_isid := id_dcache;    fault.fault_addr := (others => '0');    fs.ow := '0';    fs.fav := '0';    fs.ft := (others => '0');    fs.at_ls := '0';    fs.at_id := '0';    fs.at_su := '0';    fs.l := (others => '0');    fs.ebe := (others => '0');        fa := (others => '0');        if M_TLB_TYPE = 0 then            spltitlbout := tlbo_a0;      spltdtlbout := tlbo_a1;      twod := two; twoi := two;      twod.finish := '0'; twoi.finish := '0';      spltdtlbin := mmudci.transdata;      spltitlbin := mmuici.transdata;      mmudco_transdata := spltdtlbout.transdata;      mmuico_transdata := spltitlbout.transdata;      -- d-tlb      if ((not r.splt_ds1.tlbactive) or spltdtlbout.s1finished) = '1'  then        v.splt_ds1.tlbactive := '0';        v.splt_ds1.op.trans_op := '0';        v.splt_ds1.op.flush_op := '0';        if mmudci.trans_op = '1' then          mmudco_grant := '1';          v.splt_ds1.tlbactive := '1';          v.splt_ds1.op.trans_op := '1';        elsif mmudci.flush_op = '1' then          v.flush := '1';          mmudco_grant := '1';          v.splt_ds1.tlbactive := '1';          v.splt_ds1.op.flush_op := '1';        end if;      end if;            -- i-tlb      if ((not r.splt_is1.tlbactive) or spltitlbout.s1finished) = '1'  then        v.splt_is1.tlbactive := '0';        v.splt_is1.op.trans_op := '0';        v.splt_is1.op.flush_op := '0';        if v.flush = '1' then          v.flush := '0';

⌨️ 快捷键说明

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