1 |
63 |
zero_gravi |
-- #################################################################################################
|
2 |
|
|
-- # << NEORV32 - Test Setup using the internal IMEM as ROM to run pre-installed executables >> #
|
3 |
|
|
-- # ********************************************************************************************* #
|
4 |
|
|
-- # BSD 3-Clause License #
|
5 |
|
|
-- # #
|
6 |
|
|
-- # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
7 |
|
|
-- # #
|
8 |
|
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
9 |
|
|
-- # permitted provided that the following conditions are met: #
|
10 |
|
|
-- # #
|
11 |
|
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
12 |
|
|
-- # conditions and the following disclaimer. #
|
13 |
|
|
-- # #
|
14 |
|
|
-- # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
15 |
|
|
-- # conditions and the following disclaimer in the documentation and/or other materials #
|
16 |
|
|
-- # provided with the distribution. #
|
17 |
|
|
-- # #
|
18 |
|
|
-- # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
19 |
|
|
-- # endorse or promote products derived from this software without specific prior written #
|
20 |
|
|
-- # permission. #
|
21 |
|
|
-- # #
|
22 |
|
|
-- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
23 |
|
|
-- # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
24 |
|
|
-- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
25 |
|
|
-- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
26 |
|
|
-- # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
27 |
|
|
-- # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
28 |
|
|
-- # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
29 |
|
|
-- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
30 |
|
|
-- # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
31 |
|
|
-- # ********************************************************************************************* #
|
32 |
|
|
-- # The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 #
|
33 |
|
|
-- #################################################################################################
|
34 |
|
|
|
35 |
|
|
library ieee;
|
36 |
|
|
use ieee.std_logic_1164.all;
|
37 |
|
|
use ieee.numeric_std.all;
|
38 |
|
|
|
39 |
|
|
library neorv32;
|
40 |
|
|
use neorv32.neorv32_package.all;
|
41 |
|
|
|
42 |
|
|
entity neorv32_test_setup_approm is
|
43 |
|
|
generic (
|
44 |
|
|
-- adapt these for your setup --
|
45 |
|
|
CLOCK_FREQUENCY : natural := 100000000; -- clock frequency of clk_i in Hz
|
46 |
|
|
MEM_INT_IMEM_SIZE : natural := 16*1024; -- size of processor-internal instruction memory in bytes
|
47 |
|
|
MEM_INT_DMEM_SIZE : natural := 8*1024 -- size of processor-internal data memory in bytes
|
48 |
|
|
);
|
49 |
|
|
port (
|
50 |
|
|
-- Global control --
|
51 |
|
|
clk_i : in std_ulogic; -- global clock, rising edge
|
52 |
|
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|
53 |
|
|
-- GPIO --
|
54 |
|
|
gpio_o : out std_ulogic_vector(7 downto 0) -- parallel output
|
55 |
|
|
);
|
56 |
|
|
end entity;
|
57 |
|
|
|
58 |
|
|
architecture neorv32_test_setup_approm_rtl of neorv32_test_setup_approm is
|
59 |
|
|
|
60 |
|
|
signal con_gpio_o : std_ulogic_vector(63 downto 0);
|
61 |
|
|
|
62 |
|
|
begin
|
63 |
|
|
|
64 |
|
|
-- The Core Of The Problem ----------------------------------------------------------------
|
65 |
|
|
-- -------------------------------------------------------------------------------------------
|
66 |
|
|
neorv32_top_inst: neorv32_top
|
67 |
|
|
generic map (
|
68 |
|
|
-- General --
|
69 |
|
|
CLOCK_FREQUENCY => CLOCK_FREQUENCY, -- clock frequency of clk_i in Hz
|
70 |
|
|
INT_BOOTLOADER_EN => false, -- boot configuration: true = boot explicit bootloader; false = boot from int/ext (I)MEM
|
71 |
|
|
-- RISC-V CPU Extensions --
|
72 |
|
|
CPU_EXTENSION_RISCV_C => true, -- implement compressed extension?
|
73 |
|
|
CPU_EXTENSION_RISCV_M => true, -- implement mul/div extension?
|
74 |
|
|
CPU_EXTENSION_RISCV_Zicsr => true, -- implement CSR system?
|
75 |
66 |
zero_gravi |
CPU_EXTENSION_RISCV_Zicntr => true, -- implement base counters?
|
76 |
63 |
zero_gravi |
-- Internal Instruction memory --
|
77 |
|
|
MEM_INT_IMEM_EN => true, -- implement processor-internal instruction memory
|
78 |
|
|
MEM_INT_IMEM_SIZE => MEM_INT_IMEM_SIZE, -- size of processor-internal instruction memory in bytes
|
79 |
|
|
-- Internal Data memory --
|
80 |
|
|
MEM_INT_DMEM_EN => true, -- implement processor-internal data memory
|
81 |
|
|
MEM_INT_DMEM_SIZE => MEM_INT_DMEM_SIZE, -- size of processor-internal data memory in bytes
|
82 |
|
|
-- Processor peripherals --
|
83 |
|
|
IO_GPIO_EN => true, -- implement general purpose input/output port unit (GPIO)?
|
84 |
|
|
IO_MTIME_EN => true -- implement machine system timer (MTIME)?
|
85 |
|
|
)
|
86 |
|
|
port map (
|
87 |
|
|
-- Global control --
|
88 |
|
|
clk_i => clk_i, -- global clock, rising edge
|
89 |
|
|
rstn_i => rstn_i, -- global reset, low-active, async
|
90 |
|
|
-- GPIO (available if IO_GPIO_EN = true) --
|
91 |
|
|
gpio_o => con_gpio_o -- parallel output
|
92 |
|
|
);
|
93 |
|
|
|
94 |
|
|
-- GPIO output --
|
95 |
|
|
gpio_o <= con_gpio_o(7 downto 0);
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
end architecture;
|