OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_cpu.vhd] - Diff between revs 15 and 16

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 15 Rev 16
Line 61... Line 61...
    CPU_EXTENSION_RISCV_U        : boolean := false; -- implement user mode extension?
    CPU_EXTENSION_RISCV_U        : boolean := false; -- implement user mode extension?
    CPU_EXTENSION_RISCV_Zicsr    : boolean := true;  -- implement CSR system?
    CPU_EXTENSION_RISCV_Zicsr    : boolean := true;  -- implement CSR system?
    CPU_EXTENSION_RISCV_Zifencei : boolean := true;  -- implement instruction stream sync.?
    CPU_EXTENSION_RISCV_Zifencei : boolean := true;  -- implement instruction stream sync.?
    -- Physical Memory Protection (PMP) --
    -- Physical Memory Protection (PMP) --
    PMP_USE                      : boolean := false; -- implement PMP?
    PMP_USE                      : boolean := false; -- implement PMP?
    PMP_NUM_REGIONS              : natural := 4;     -- number of regions (max 16)
    PMP_NUM_REGIONS              : natural := 4;     -- number of regions (max 8)
    PMP_GRANULARITY              : natural := 15;    -- region granularity (1=8B, 2=16B, 3=32B, ...) default is 64k
    PMP_GRANULARITY              : natural := 14;    -- minimal region granularity (1=8B, 2=16B, 3=32B, ...) default is 64k
    -- Bus Interface --
    -- Bus Interface --
    BUS_TIMEOUT                  : natural := 15     -- cycles after which a valid bus access will timeout
    BUS_TIMEOUT                  : natural := 15     -- cycles after which a valid bus access will timeout
  );
  );
  port (
  port (
    -- global control --
    -- global control --
Line 135... Line 135...
  signal cp0_data,  cp1_data  : std_ulogic_vector(data_width_c-1 downto 0);
  signal cp0_data,  cp1_data  : std_ulogic_vector(data_width_c-1 downto 0);
  signal cp0_valid, cp1_valid : std_ulogic;
  signal cp0_valid, cp1_valid : std_ulogic;
 
 
  -- pmp interface --
  -- pmp interface --
  signal pmp_addr  : pmp_addr_if_t;
  signal pmp_addr  : pmp_addr_if_t;
  signal pmp_maddr : pmp_addr_if_t;
 
  signal pmp_ctrl  : pmp_ctrl_if_t;
  signal pmp_ctrl  : pmp_ctrl_if_t;
  signal priv_mode : std_ulogic_vector(1 downto 0); -- current CPU privilege level
  signal priv_mode : std_ulogic_vector(1 downto 0); -- current CPU privilege level
 
 
begin
begin
 
 
Line 152... Line 151...
      if (CPU_EXTENSION_RISCV_Zicsr = false) then
      if (CPU_EXTENSION_RISCV_Zicsr = false) then
        assert false report "NEORV32 CONFIG WARNING! No exception/interrupt/machine features available when CPU_EXTENSION_RISCV_Zicsr = false." severity warning;
        assert false report "NEORV32 CONFIG WARNING! No exception/interrupt/machine features available when CPU_EXTENSION_RISCV_Zicsr = false." severity warning;
      end if;
      end if;
      -- U-extension requires Zicsr extension --
      -- U-extension requires Zicsr extension --
      if (CPU_EXTENSION_RISCV_Zicsr = false) and (CPU_EXTENSION_RISCV_U = true) then
      if (CPU_EXTENSION_RISCV_Zicsr = false) and (CPU_EXTENSION_RISCV_U = true) then
        assert false report "NEORV32 CONFIG ERROR! User mode requires CPU_EXTENSION_RISCV_Zicsr = true." severity error;
        assert false report "NEORV32 CONFIG ERROR! User mode requires CPU_EXTENSION_RISCV_Zicsr extension." severity error;
      end if;
      end if;
      -- PMP requires Zicsr extension --
      -- PMP requires Zicsr extension --
      if (CPU_EXTENSION_RISCV_Zicsr = false) and (PMP_USE = true) then
      if (CPU_EXTENSION_RISCV_Zicsr = false) and (PMP_USE = true) then
        assert false report "NEORV32 CONFIG ERROR! Physical memory protection (PMP) requires CPU_EXTENSION_RISCV_Zicsr = true." severity error;
        assert false report "NEORV32 CONFIG ERROR! Physical memory protection (PMP) requires CPU_EXTENSION_RISCV_Zicsr extension." severity error;
      end if;
      end if;
      -- performance counters requires Zicsr extension --
      -- performance counters require Zicsr extension --
      if (CPU_EXTENSION_RISCV_Zicsr = false) and (CSR_COUNTERS_USE = true) then
      if (CPU_EXTENSION_RISCV_Zicsr = false) and (CSR_COUNTERS_USE = true) then
        assert false report "NEORV32 CONFIG ERROR! Performance counter CSRs require CPU_EXTENSION_RISCV_Zicsr = true." severity error;
        assert false report "NEORV32 CONFIG ERROR! Performance counter CSRs require CPU_EXTENSION_RISCV_Zicsr extension." severity error;
      end if;
      end if;
      -- PMP regions --
      -- PMP regions --
      if (PMP_NUM_REGIONS > pmp_max_r_c) and (PMP_USE = true) then
      if (PMP_NUM_REGIONS > pmp_max_r_c) and (PMP_USE = true) then
        assert false report "NEORV32 CONFIG ERROR! Number of PMP regions out of valid range." severity error;
        assert false report "NEORV32 CONFIG ERROR! Number of PMP regions out of valid range." severity error;
      end if;
      end if;
      -- PMP granulartiy --
      -- PMP granulartiy --
      if ((PMP_GRANULARITY <= 1) or (PMP_GRANULARITY > 31)) and (PMP_USE = true) then
      if ((PMP_GRANULARITY < 1) or (PMP_GRANULARITY > 32)) and (PMP_USE = true) then
        assert false report "NEORV32 CONFIG ERROR! Invalid PMP grnaulartiy (1 < G < 32)." severity error;
        assert false report "NEORV32 CONFIG ERROR! Invalid PMP granulartiy (0 < G < 33)." severity error;
      end if;
      end if;
    end if;
    end if;
  end process sanity_check;
  end process sanity_check;
 
 
  -- Control Unit ---------------------------------------------------------------------------
  -- Control Unit ---------------------------------------------------------------------------
Line 224... Line 223...
    firq_i        => firq_i,
    firq_i        => firq_i,
    -- system time input from MTIME --
    -- system time input from MTIME --
    time_i        => time_i,      -- current system time
    time_i        => time_i,      -- current system time
    -- physical memory protection --
    -- physical memory protection --
    pmp_addr_o    => pmp_addr,    -- addresses
    pmp_addr_o    => pmp_addr,    -- addresses
    pmp_maddr_i   => pmp_maddr,   -- masked addresses
 
    pmp_ctrl_o    => pmp_ctrl,    -- configs
    pmp_ctrl_o    => pmp_ctrl,    -- configs
    priv_mode_o   => priv_mode,   -- current CPU privilege level
    priv_mode_o   => priv_mode,   -- current CPU privilege level
    -- bus access exceptions --
    -- bus access exceptions --
    mar_i         => mar,         -- memory address register
    mar_i         => mar,         -- memory address register
    ma_instr_i    => ma_instr,    -- misaligned instruction address
    ma_instr_i    => ma_instr,    -- misaligned instruction address
Line 358... Line 356...
    ma_store_o     => ma_store,       -- misaligned store data address
    ma_store_o     => ma_store,       -- misaligned store data address
    be_load_o      => be_load,        -- bus error on load data access
    be_load_o      => be_load,        -- bus error on load data access
    be_store_o     => be_store,       -- bus error on store data access
    be_store_o     => be_store,       -- bus error on store data access
    -- physical memory protection --
    -- physical memory protection --
    pmp_addr_i     => pmp_addr,       -- addresses
    pmp_addr_i     => pmp_addr,       -- addresses
    pmp_maddr_o    => pmp_maddr,      -- masked addresses
 
    pmp_ctrl_i     => pmp_ctrl,       -- configs
    pmp_ctrl_i     => pmp_ctrl,       -- configs
    priv_mode_i    => priv_mode,      -- current CPU privilege level
    priv_mode_i    => priv_mode,      -- current CPU privilege level
    -- instruction bus --
    -- instruction bus --
    i_bus_addr_o   => i_bus_addr_o,   -- bus access address
    i_bus_addr_o   => i_bus_addr_o,   -- bus access address
    i_bus_rdata_i  => i_bus_rdata_i,  -- bus read data
    i_bus_rdata_i  => i_bus_rdata_i,  -- bus read data

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.