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

📄 amba.vhd

📁 free hardware ip core about sparcv8,a soc cpu in vhdl
💻 VHD
📖 第 1 页 / 共 2 页
字号:
  );  end component;  component apbctrl  generic (    hindex      : integer := 0;    haddr       : integer := 0;    hmask       : integer := 16#fff#;    nslaves     : integer range 1 to NAPBSLV := NAPBSLV;    debug       : integer range 0 to 2 := 2;   -- print config to console    icheck      : integer range 0 to 1 := 1;    enbusmon    : integer range 0 to 1 := 0;    asserterr   : integer range 0 to 1 := 0;    assertwarn  : integer range 0 to 1 := 0;    pslvdisable : integer := 0  );  port (    rst     : in  std_ulogic;    clk     : in  std_ulogic;    ahbi    : in  ahb_slv_in_type;    ahbo    : out ahb_slv_out_type;    apbi    : out apb_slv_in_type;    apbo    : in  apb_slv_out_vector  );  end component;  component ahbctrl_mb  generic (    defmast : integer := 0;		-- default master    split   : integer := 0;		-- split support    rrobin  : integer := 0;		-- round-robin arbitration    timeout : integer range 0 to 255 := 0;  -- HREADY timeout    ioaddr  : ahb_addr_type := 16#fff#;  -- I/O area MSB address    iomask  : ahb_addr_type := 16#fff#;  -- I/O area address mask    cfgaddr : ahb_addr_type := 16#ff0#;  -- config area MSB address    cfgmask : ahb_addr_type := 16#ff0#;   -- config area address mask    nahbm   : integer range 1 to NAHBMST := NAHBMST; -- number of masters    nahbs   : integer range 1 to NAHBSLV := NAHBSLV; -- number of slaves    ioen    : integer range 0 to 15 := 1;   -- enable I/O area    disirq  : integer range 0 to 1 := 0;   -- disable interrupt routing    fixbrst : integer range 0 to 1 := 0;   -- support fix-length bursts    debug   : integer range 0 to 2 := 2;   -- report cores to console    fpnpen  : integer range 0 to 1 := 0;   -- full PnP configuration decoding    busndx  : integer range 0 to 3 := 0;    icheck  : integer range 0 to 1 := 1;        devid   : integer := 0		   -- unique device ID  );  port (    rst     : in  std_ulogic;    clk     : in  std_ulogic;    msti    : out ahb_mst_in_type;    msto    : in  ahb_mst_out_bus_vector;    slvi    : out ahb_slv_in_type;    slvo    : in  ahb_slv_out_bus_vector  );  end component;  component ahbdefmst    generic ( hindex : integer range 0 to NAHBMST-1 := 0);    port ( ahbmo  : out ahb_mst_out_type);  end component;-- pragma translate_off  component ahbmon is  generic(    asserterr   : integer range 0 to 1 := 1;    assertwarn  : integer range 0 to 1 := 1;    hmstdisable : integer := 0;    hslvdisable : integer := 0;    arbdisable  : integer := 0;    nahbm       : integer range 0 to NAHBMST := NAHBMST;    nahbs       : integer range 0 to NAHBSLV := NAHBSLV  );  port(    rst         : in std_ulogic;    clk         : in std_ulogic;    ahbmi       : in ahb_mst_in_type;    ahbmo       : in ahb_mst_out_vector;    ahbsi       : in ahb_slv_in_type;    ahbso       : in ahb_slv_out_vector;    err         : out std_ulogic);  end component;  component apbmon is  generic(    asserterr   : integer range 0 to 1 := 1;    assertwarn  : integer range 0 to 1 := 1;    pslvdisable : integer := 0;    napb        : integer range 0 to NAPBSLV := NAPBSLV  );  port(    rst         : in std_ulogic;    clk         : in std_ulogic;    apbi        : in apb_slv_in_type;    apbo        : in apb_slv_out_vector;    err         : out std_ulogic);  end component;    component ambamon is    generic(      asserterr   : integer range 0 to 1 := 1;      assertwarn  : integer range 0 to 1 := 1;      hmstdisable : integer := 0;      hslvdisable : integer := 0;      pslvdisable : integer := 0;      arbdisable  : integer := 0;      nahbm       : integer range 0 to NAHBMST := NAHBMST;      nahbs       : integer range 0 to NAHBSLV := NAHBSLV;      napb        : integer range 0 to NAPBSLV := NAPBSLV    );    port(      rst        : in std_ulogic;      clk        : in std_ulogic;      ahbmi      : in ahb_mst_in_type;      ahbmo      : in ahb_mst_out_vector;      ahbsi      : in ahb_slv_in_type;      ahbso      : in ahb_slv_out_vector;      apbi       : in apb_slv_in_type;      apbo       : in apb_slv_out_vector;      err        : out std_ulogic);  end component;    subtype vendor_description is string(1 to 24);  subtype device_description is string(1 to 31);  type device_table_type is array (0 to 1023) of device_description;  type vendor_library_type is record    vendorid	 : amba_vendor_type;    vendordesc   : vendor_description;    device_table : device_table_type;  end record;  type device_array is array (0 to 255) of vendor_library_type;-- pragma translate_onend;package body amba is  function ahb_device_reg(vendor : amba_vendor_type; device : amba_device_type;	cfgver : amba_cfgver_type; version : amba_version_type;        interrupt : amba_irq_type)  return std_logic_vector is  variable cfg : std_logic_vector(31 downto 0);  begin    case cfgver is    when 0 =>      cfg(31 downto 24) := std_logic_vector(to_unsigned(vendor, 8));      cfg(23 downto 12) := std_logic_vector(to_unsigned(device, 12));      cfg(11 downto 10) := std_logic_vector(to_unsigned(cfgver, 2));      cfg( 9 downto  5) := std_logic_vector(to_unsigned(version, 5));      cfg( 4 downto  0) := std_logic_vector(to_unsigned(interrupt, 5));    when others => cfg := (others => '0');    end case;    return(cfg);  end;  function ahb_membar(memaddr : ahb_addr_type; prefetch, cache : std_ulogic;	addrmask : ahb_addr_type)  return std_logic_vector is  variable cfg : std_logic_vector(31 downto 0);  begin    cfg(31 downto 20) := std_logic_vector(to_unsigned(memaddr, 12));    cfg(19 downto 16) := "00" & prefetch & cache;    cfg(15 downto  4) := std_logic_vector(to_unsigned(addrmask, 12));    cfg( 3 downto  0) := "0010";    return(cfg);  end;  function ahb_membar_opt(memaddr : ahb_addr_type; prefetch, cache : std_ulogic;	addrmask : ahb_addr_type; enable : integer)  return std_logic_vector is  variable cfg : std_logic_vector(31 downto 0);  begin    cfg := (others => '0');    if enable /= 0 then      return (ahb_membar(memaddr, prefetch, cache, addrmask));    else return(cfg); end if;  end;  function ahb_iobar(memaddr : ahb_addr_type; addrmask : ahb_addr_type)  return std_logic_vector is  variable cfg : std_logic_vector(31 downto 0);  begin    cfg(31 downto 20) := std_logic_vector(to_unsigned(memaddr, 12));    cfg(19 downto 16) := "0000";    cfg(15 downto  4) := std_logic_vector(to_unsigned(addrmask, 12));    cfg( 3 downto  0) := "0011";    return(cfg);  end;  function apb_iobar(memaddr : ahb_addr_type; addrmask : ahb_addr_type)  return std_logic_vector is  variable cfg : std_logic_vector(31 downto 0);  begin    cfg(31 downto 20) := std_logic_vector(to_unsigned(memaddr, 12));    cfg(19 downto 16) := "0000";    cfg(15 downto  4) := std_logic_vector(to_unsigned(addrmask, 12));    cfg( 3 downto  0) := "0001";    return(cfg);  end;  function ahb_slv_dec_cache(haddr : std_logic_vector(31 downto 0);                             ahbso : ahb_slv_out_vector; cached : integer)  return std_ulogic is    variable hcache : std_ulogic;    variable ctbl : std_logic_vector(15 downto 0);  begin    hcache := '0'; ctbl := (others => '0');    if cached = 0 then      for i in 0 to NAHBSLV-1 loop        for j in NAHBAMR to NAHBCFG-1 loop          if (ahbso(i).hconfig(j)(16) = '1') and 		(ahbso(i).hconfig(j)(15 downto 4) /= "000000000000")	  then            if (haddr(31 downto 20) and ahbso(i).hconfig(j)(15 downto 4)) =              (ahbso(i).hconfig(j)(31 downto 20) and ahbso(i).hconfig(j)(15 downto 4)) then              hcache := '1';            end if;          end if;        end loop;      end loop;    else      ctbl := conv_std_logic_vector(cached, 16);      hcache := ctbl(conv_integer(haddr(31 downto 28)));    end if;    return(hcache);  end;  function ahb_slv_dec_pfetch(haddr : std_logic_vector(31 downto 0);                             ahbso : ahb_slv_out_vector)  return std_ulogic is    variable pfetch : std_ulogic;  begin    pfetch := '0';    for i in 0 to NAHBSLV-1 loop      for j in NAHBAMR to NAHBCFG-1 loop        if ahbso(i).hconfig(j)(17) = '1' then          if (haddr(31 downto 20) and ahbso(i).hconfig(j)(15 downto 4)) =            (ahbso(i).hconfig(j)(31 downto 20) and ahbso(i).hconfig(j)(15 downto 4)) then            pfetch := '1';          end if;        end if;      end loop;    end loop;    return(pfetch);  end;end;

⌨️ 快捷键说明

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