Line 53... |
Line 53... |
constant ipb_entries_c : natural := 2; -- entries in CPU instruction prefetch buffer, has to be a power of 2, default=2
|
constant ipb_entries_c : natural := 2; -- entries in CPU instruction prefetch buffer, has to be a power of 2, default=2
|
|
|
-- Architecture Constants (do not modify!)= -----------------------------------------------
|
-- Architecture Constants (do not modify!)= -----------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
constant data_width_c : natural := 32; -- data width - do not change!
|
constant data_width_c : natural := 32; -- data width - do not change!
|
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01050000"; -- no touchy!
|
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01050003"; -- no touchy!
|
constant pmp_max_r_c : natural := 8; -- max PMP regions - FIXED!
|
constant pmp_max_r_c : natural := 8; -- max PMP regions - FIXED!
|
constant archid_c : natural := 19; -- official NEORV32 architecture ID - hands off!
|
constant archid_c : natural := 19; -- official NEORV32 architecture ID - hands off!
|
constant rf_r0_is_reg_c : boolean := true; -- reg_file.r0 is a *physical register* that has to be initialized to zero by the CPU HW
|
constant rf_r0_is_reg_c : boolean := true; -- reg_file.r0 is a *physical register* that has to be initialized to zero by the CPU HW
|
|
|
-- Helper Functions -----------------------------------------------------------------------
|
-- Helper Functions -----------------------------------------------------------------------
|
Line 706... |
Line 706... |
constant hpmcnt_event_never_c : natural := 1;
|
constant hpmcnt_event_never_c : natural := 1;
|
constant hpmcnt_event_ir_c : natural := 2; -- Retired instruction
|
constant hpmcnt_event_ir_c : natural := 2; -- Retired instruction
|
constant hpmcnt_event_cir_c : natural := 3; -- Retired compressed instruction
|
constant hpmcnt_event_cir_c : natural := 3; -- Retired compressed instruction
|
constant hpmcnt_event_wait_if_c : natural := 4; -- Instruction fetch memory wait cycle
|
constant hpmcnt_event_wait_if_c : natural := 4; -- Instruction fetch memory wait cycle
|
constant hpmcnt_event_wait_ii_c : natural := 5; -- Instruction issue wait cycle
|
constant hpmcnt_event_wait_ii_c : natural := 5; -- Instruction issue wait cycle
|
constant hpmcnt_event_load_c : natural := 6; -- Load operation
|
constant hpmcnt_event_wait_mc_c : natural := 6; -- Multi-cycle ALU-operation wait cycle
|
constant hpmcnt_event_store_c : natural := 7; -- Store operation
|
constant hpmcnt_event_load_c : natural := 7; -- Load operation
|
constant hpmcnt_event_wait_ls_c : natural := 8; -- Load/store memory wait cycle
|
constant hpmcnt_event_store_c : natural := 8; -- Store operation
|
constant hpmcnt_event_jump_c : natural := 9; -- Unconditional jump
|
constant hpmcnt_event_wait_ls_c : natural := 9; -- Load/store memory wait cycle
|
constant hpmcnt_event_branch_c : natural := 10; -- Conditional branch (taken or not taken)
|
constant hpmcnt_event_jump_c : natural := 10; -- Unconditional jump
|
constant hpmcnt_event_tbranch_c : natural := 11; -- Conditional taken branch
|
constant hpmcnt_event_branch_c : natural := 11; -- Conditional branch (taken or not taken)
|
constant hpmcnt_event_trap_c : natural := 12; -- Entered trap
|
constant hpmcnt_event_tbranch_c : natural := 12; -- Conditional taken branch
|
constant hpmcnt_event_illegal_c : natural := 13; -- Illegal instruction exception
|
constant hpmcnt_event_trap_c : natural := 13; -- Entered trap
|
|
constant hpmcnt_event_illegal_c : natural := 14; -- Illegal instruction exception
|
--
|
--
|
constant hpmcnt_event_size_c : natural := 14; -- length of this list
|
constant hpmcnt_event_size_c : natural := 15; -- length of this list
|
|
|
-- Clock Generator ------------------------------------------------------------------------
|
-- Clock Generator ------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
constant clk_div2_c : natural := 0;
|
constant clk_div2_c : natural := 0;
|
constant clk_div4_c : natural := 1;
|
constant clk_div4_c : natural := 1;
|
Line 765... |
Line 766... |
MEM_INT_DMEM_SIZE : natural := 8*1024; -- size of processor-internal data memory in bytes
|
MEM_INT_DMEM_SIZE : natural := 8*1024; -- size of processor-internal data memory in bytes
|
-- Internal Cache memory --
|
-- Internal Cache memory --
|
ICACHE_EN : boolean := false; -- implement instruction cache
|
ICACHE_EN : boolean := false; -- implement instruction cache
|
ICACHE_NUM_BLOCKS : natural := 4; -- i-cache: number of blocks (min 1), has to be a power of 2
|
ICACHE_NUM_BLOCKS : natural := 4; -- i-cache: number of blocks (min 1), has to be a power of 2
|
ICACHE_BLOCK_SIZE : natural := 64; -- i-cache: block size in bytes (min 4), has to be a power of 2
|
ICACHE_BLOCK_SIZE : natural := 64; -- i-cache: block size in bytes (min 4), has to be a power of 2
|
|
ICACHE_ASSOCIATIVITY : natural := 1; -- i-cache: associativity / number of sets (1=direct_mapped), has to be a power of 2
|
-- External memory interface --
|
-- External memory interface --
|
MEM_EXT_EN : boolean := false; -- implement external memory bus interface?
|
MEM_EXT_EN : boolean := false; -- implement external memory bus interface?
|
-- Processor peripherals --
|
-- Processor peripherals --
|
IO_GPIO_EN : boolean := true; -- implement general purpose input/output port unit (GPIO)?
|
IO_GPIO_EN : boolean := true; -- implement general purpose input/output port unit (GPIO)?
|
IO_MTIME_EN : boolean := true; -- implement machine system timer (MTIME)?
|
IO_MTIME_EN : boolean := true; -- implement machine system timer (MTIME)?
|
Line 1116... |
Line 1118... |
d_bus_fence_o : out std_ulogic; -- fence operation
|
d_bus_fence_o : out std_ulogic; -- fence operation
|
d_bus_lock_o : out std_ulogic -- locked/exclusive access
|
d_bus_lock_o : out std_ulogic -- locked/exclusive access
|
);
|
);
|
end component;
|
end component;
|
|
|
-- Component: CPU Cache -------------------------------------------------------------------
|
-- Component: CPU Instruction Cache -------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
component neorv32_cache
|
component neorv32_icache
|
generic (
|
generic (
|
CACHE_NUM_BLOCKS : natural := 4; -- number of blocks (min 1), has to be a power of 2
|
CACHE_NUM_BLOCKS : natural := 4; -- number of blocks (min 1), has to be a power of 2
|
CACHE_BLOCK_SIZE : natural := 16 -- block size in bytes (min 4), has to be a power of 2
|
CACHE_BLOCK_SIZE : natural := 16; -- block size in bytes (min 4), has to be a power of 2
|
|
CACHE_NUM_SETS : natural := 1 -- associativity / number of sets (1=direct_mapped), has to be a power of 2
|
);
|
);
|
port (
|
port (
|
-- global control --
|
-- global control --
|
clk_i : in std_ulogic; -- global clock, rising edge
|
clk_i : in std_ulogic; -- global clock, rising edge
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|