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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [processor_templates/] [neorv32_ProcessorTop_Minimal.vhd] - Blame information for rev 70

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 63 zero_gravi
-- #################################################################################################
2
-- # << NEORV32 - Minimal setup without a bootloader >>                                            #
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 Processor - https://github.com/stnolting/neorv32              (c) Stephan Nolting #
33
-- #################################################################################################
34
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
 
39
library neorv32;
40
 
41
entity neorv32_ProcessorTop_Minimal is
42
  generic (
43
    CLOCK_FREQUENCY              : natural := 0;      -- clock frequency of clk_i in Hz
44
    HW_THREAD_ID                 : natural := 0;      -- hardware thread id (32-bit)
45
 
46
    -- RISC-V CPU Extensions --
47
    CPU_EXTENSION_RISCV_A        : boolean := false;  -- implement atomic extension?
48
    CPU_EXTENSION_RISCV_C        : boolean := false;  -- implement compressed extension?
49
    CPU_EXTENSION_RISCV_E        : boolean := false;  -- implement embedded RF extension?
50
    CPU_EXTENSION_RISCV_M        : boolean := false;  -- implement mul/div extension?
51
    CPU_EXTENSION_RISCV_U        : boolean := false;  -- implement user mode extension?
52
    CPU_EXTENSION_RISCV_Zfinx    : boolean := false;  -- implement 32-bit floating-point extension (using INT regs!)
53
    CPU_EXTENSION_RISCV_Zicsr    : boolean := true;   -- implement CSR system?
54
    CPU_EXTENSION_RISCV_Zifencei : boolean := false;  -- implement instruction stream sync.?
55
 
56
    -- Extension Options --
57
    FAST_MUL_EN                  : boolean := false;  -- use DSPs for M extension's multiplier
58
    FAST_SHIFT_EN                : boolean := false;  -- use barrel shifter for shift operations
59
    CPU_CNT_WIDTH                : natural := 34;     -- total width of CPU cycle and instret counters (0..64)
60
 
61
    -- Physical Memory Protection (PMP) --
62
    PMP_NUM_REGIONS              : natural := 0;       -- number of regions (0..64)
63
    PMP_MIN_GRANULARITY          : natural := 8*1024;  -- minimal region granularity in bytes, has to be a power of 2, min 8 bytes
64
 
65
    -- Hardware Performance Monitors (HPM) --
66
    HPM_NUM_CNTS                 : natural := 0;       -- number of implemented HPM counters (0..29)
67
    HPM_CNT_WIDTH                : natural := 40;      -- total size of HPM counters (0..64)
68
 
69
    -- Internal Instruction memory --
70
    MEM_INT_IMEM_EN              : boolean := true;    -- implement processor-internal instruction memory
71
    MEM_INT_IMEM_SIZE            : natural := 8*1024;  -- size of processor-internal instruction memory in bytes
72
 
73
    -- Internal Data memory --
74
    MEM_INT_DMEM_EN              : boolean := true;    -- implement processor-internal data memory
75
    MEM_INT_DMEM_SIZE            : natural := 64*1024; -- size of processor-internal data memory in bytes
76
 
77
    -- Internal Cache memory --
78
    ICACHE_EN                    : boolean := false;  -- implement instruction cache
79
    ICACHE_NUM_BLOCKS            : natural := 4;      -- i-cache: number of blocks (min 1), has to be a power of 2
80
    ICACHE_BLOCK_SIZE            : natural := 64;     -- i-cache: block size in bytes (min 4), has to be a power of 2
81
    ICACHE_ASSOCIATIVITY         : natural := 1;      -- i-cache: associativity / number of sets (1=direct_mapped), has to be a power of 2
82
 
83
    -- Processor peripherals --
84
    IO_MTIME_EN                  : boolean := false;  -- implement machine system timer (MTIME)?
85
    IO_PWM_NUM_CH                : natural := 3;      -- number of PWM channels to implement (0..60); 0 = disabled
86
    IO_WDT_EN                    : boolean := false   -- implement watch dog timer (WDT)?
87
  );
88
  port (
89
    clk_i      : in  std_logic;
90
    rstn_i     : in  std_logic;
91
 
92
    -- PWM (available if IO_PWM_NUM_CH > 0) --
93
    pwm_o      : out std_ulogic_vector(IO_PWM_NUM_CH-1 downto 0)
94
  );
95
end entity;
96
 
97
architecture neorv32_ProcessorTop_Minimal_rtl of neorv32_ProcessorTop_Minimal is
98
 
99 70 zero_gravi
  -- internal IO connection --
100
  signal con_pwm_o  : std_ulogic_vector(59 downto 0);
101
 
102 63 zero_gravi
begin
103
 
104 70 zero_gravi
  -- IO Connection --------------------------------------------------------------------------
105
  -- -------------------------------------------------------------------------------------------
106
 
107
  -- PWM --
108
  pwm_o <= con_pwm_o(IO_PWM_NUM_CH-1 downto 0);
109
 
110
 
111 63 zero_gravi
  -- The core of the problem ----------------------------------------------------------------
112
  -- -------------------------------------------------------------------------------------------
113
  neorv32_inst: entity neorv32.neorv32_top
114
  generic map (
115
    -- General --
116
    CLOCK_FREQUENCY              => CLOCK_FREQUENCY,  -- clock frequency of clk_i in Hz
117
    INT_BOOTLOADER_EN            => false,            -- boot configuration: true = boot explicit bootloader; false = boot from int/ext (I)MEM
118
    HW_THREAD_ID                 => HW_THREAD_ID,     -- hardware thread id (32-bit)
119
 
120
    -- On-Chip Debugger (OCD) --
121
    ON_CHIP_DEBUGGER_EN          => false,  -- implement on-chip debugger?
122
 
123
    -- RISC-V CPU Extensions --
124
    CPU_EXTENSION_RISCV_A        => CPU_EXTENSION_RISCV_A,         -- implement atomic extension?
125
    CPU_EXTENSION_RISCV_C        => CPU_EXTENSION_RISCV_C,         -- implement compressed extension?
126
    CPU_EXTENSION_RISCV_E        => CPU_EXTENSION_RISCV_E,         -- implement embedded RF extension?
127
    CPU_EXTENSION_RISCV_M        => CPU_EXTENSION_RISCV_M,         -- implement mul/div extension?
128
    CPU_EXTENSION_RISCV_U        => CPU_EXTENSION_RISCV_U,         -- implement user mode extension?
129
    CPU_EXTENSION_RISCV_Zfinx    => CPU_EXTENSION_RISCV_Zfinx,     -- implement 32-bit floating-point extension (using INT regs!)
130
    CPU_EXTENSION_RISCV_Zicsr    => CPU_EXTENSION_RISCV_Zicsr,     -- implement CSR system?
131 66 zero_gravi
    CPU_EXTENSION_RISCV_Zicntr   => true,                          -- implement base counters?
132 63 zero_gravi
    CPU_EXTENSION_RISCV_Zifencei => CPU_EXTENSION_RISCV_Zifencei,  -- implement instruction stream sync.?
133
 
134
    -- Extension Options --
135
    FAST_MUL_EN                  => FAST_MUL_EN,    -- use DSPs for M extension's multiplier
136
    FAST_SHIFT_EN                => FAST_SHIFT_EN,  -- use barrel shifter for shift operations
137
    CPU_CNT_WIDTH                => CPU_CNT_WIDTH,  -- total width of CPU cycle and instret counters (0..64)
138
 
139
    -- Physical Memory Protection (PMP) --
140
    PMP_NUM_REGIONS              => PMP_NUM_REGIONS,       -- number of regions (0..64)
141
    PMP_MIN_GRANULARITY          => PMP_MIN_GRANULARITY,   -- minimal region granularity in bytes, has to be a power of 2, min 8 bytes
142
 
143
    -- Hardware Performance Monitors (HPM) --
144
    HPM_NUM_CNTS                 => HPM_NUM_CNTS,          -- number of implemented HPM counters (0..29)
145
    HPM_CNT_WIDTH                => HPM_CNT_WIDTH,         -- total size of HPM counters (1..64)
146
 
147
    -- Internal Instruction memory --
148
    MEM_INT_IMEM_EN              => MEM_INT_IMEM_EN,       -- implement processor-internal instruction memory
149
    MEM_INT_IMEM_SIZE            => MEM_INT_IMEM_SIZE,     -- size of processor-internal instruction memory in bytes
150
 
151
    -- Internal Data memory --
152
    MEM_INT_DMEM_EN              => MEM_INT_DMEM_EN,       -- implement processor-internal data memory
153
    MEM_INT_DMEM_SIZE            => MEM_INT_DMEM_SIZE,     -- size of processor-internal data memory in bytes
154
 
155
    -- Internal Cache memory --
156
    ICACHE_EN                    => ICACHE_EN,             -- implement instruction cache
157
    ICACHE_NUM_BLOCKS            => ICACHE_NUM_BLOCKS,     -- i-cache: number of blocks (min 1), has to be a power of 2
158
    ICACHE_BLOCK_SIZE            => ICACHE_BLOCK_SIZE,     -- i-cache: block size in bytes (min 4), has to be a power of 2
159
    ICACHE_ASSOCIATIVITY         => ICACHE_ASSOCIATIVITY,  -- i-cache: associativity / number of sets (1=direct_mapped), has to be a power of 2
160
 
161
    -- External memory interface --
162
    MEM_EXT_EN                   => false,       -- implement external memory bus interface?
163
    MEM_EXT_TIMEOUT              => 0,           -- cycles after a pending bus access auto-terminates (0 = disabled)
164
 
165
    -- Processor peripherals --
166
    IO_GPIO_EN                   => false,         -- implement general purpose input/output port unit (GPIO)?
167
    IO_MTIME_EN                  => IO_MTIME_EN,   -- implement machine system timer (MTIME)?
168
    IO_UART0_EN                  => false,         -- implement primary universal asynchronous receiver/transmitter (UART0)?
169
    IO_UART1_EN                  => false,         -- implement secondary universal asynchronous receiver/transmitter (UART1)?
170
    IO_SPI_EN                    => false,         -- implement serial peripheral interface (SPI)?
171
    IO_TWI_EN                    => false,         -- implement two-wire interface (TWI)?
172
    IO_PWM_NUM_CH                => IO_PWM_NUM_CH, -- number of PWM channels to implement (0..60); 0 = disabled
173
    IO_WDT_EN                    => IO_WDT_EN,     -- implement watch dog timer (WDT)?
174
    IO_TRNG_EN                   => false,         -- implement true random number generator (TRNG)?
175
    IO_CFS_EN                    => false,         -- implement custom functions subsystem (CFS)?
176
    IO_CFS_CONFIG                => x"00000000",   -- custom CFS configuration generic
177
    IO_CFS_IN_SIZE               => 32,            -- size of CFS input conduit in bits
178
    IO_CFS_OUT_SIZE              => 32,            -- size of CFS output conduit in bits
179
    IO_NEOLED_EN                 => false          -- implement NeoPixel-compatible smart LED interface (NEOLED)?
180
  )
181
  port map (
182
    -- Global control --
183
    clk_i       => clk_i,                        -- global clock, rising edge
184
    rstn_i      => rstn_i,                       -- global reset, low-active, async
185
 
186
    -- JTAG on-chip debugger interface (available if ON_CHIP_DEBUGGER_EN = true) --
187
    jtag_trst_i => '0',                          -- low-active TAP reset (optional)
188
    jtag_tck_i  => '0',                          -- serial clock
189
    jtag_tdi_i  => '0',                          -- serial data input
190
    jtag_tdo_o  => open,                         -- serial data output
191
    jtag_tms_i  => '0',                          -- mode select
192
 
193
    -- Wishbone bus interface (available if MEM_EXT_EN = true) --
194
    wb_tag_o    => open,                         -- request tag
195
    wb_adr_o    => open,                         -- address
196
    wb_dat_i    => (others => '0'),              -- read data
197
    wb_dat_o    => open,                         -- write data
198
    wb_we_o     => open,                         -- read/write
199
    wb_sel_o    => open,                         -- byte enable
200
    wb_stb_o    => open,                         -- strobe
201
    wb_cyc_o    => open,                         -- valid cycle
202
    wb_lock_o   => open,                         -- exclusive access request
203
    wb_ack_i    => '0',                          -- transfer acknowledge
204
    wb_err_i    => '0',                          -- transfer error
205
 
206
    -- Advanced memory control signals (available if MEM_EXT_EN = true) --
207
    fence_o     => open,                         -- indicates an executed FENCE operation
208
    fencei_o    => open,                         -- indicates an executed FENCEI operation
209
 
210
    -- GPIO (available if IO_GPIO_EN = true) --
211
    gpio_o      => open,                         -- parallel output
212
    gpio_i      => (others => '0'),              -- parallel input
213
 
214
    -- primary UART0 (available if IO_UART0_EN = true) --
215
    uart0_txd_o => open,                         -- UART0 send data
216
    uart0_rxd_i => '0',                          -- UART0 receive data
217
    uart0_rts_o => open,                         -- hw flow control: UART0.RX ready to receive ("RTR"), low-active, optional
218
    uart0_cts_i => '0',                          -- hw flow control: UART0.TX allowed to transmit, low-active, optional
219
 
220
    -- secondary UART1 (available if IO_UART1_EN = true) --
221
    uart1_txd_o => open,                         -- UART1 send data
222
    uart1_rxd_i => '0',                          -- UART1 receive data
223
    uart1_rts_o => open,                         -- hw flow control: UART1.RX ready to receive ("RTR"), low-active, optional
224
    uart1_cts_i => '0',                          -- hw flow control: UART1.TX allowed to transmit, low-active, optional
225
 
226
    -- SPI (available if IO_SPI_EN = true) --
227
    spi_sck_o   => open,                         -- SPI serial clock
228
    spi_sdo_o   => open,                         -- controller data out, peripheral data in
229
    spi_sdi_i   => '0',                          -- controller data in, peripheral data out
230
    spi_csn_o   => open,                         -- SPI CS
231
 
232
    -- TWI (available if IO_TWI_EN = true) --
233
    twi_sda_io  => open,                         -- twi serial data line
234
    twi_scl_io  => open,                         -- twi serial clock line
235
 
236
    -- PWM (available if IO_PWM_NUM_CH > 0) --
237 70 zero_gravi
    pwm_o       => con_pwm_o,                    -- pwm channels
238 63 zero_gravi
 
239
    -- Custom Functions Subsystem IO --
240
    cfs_in_i    => (others => '0'),              -- custom CFS inputs conduit
241
    cfs_out_o   => open,                         -- custom CFS outputs conduit
242
 
243
    -- NeoPixel-compatible smart LED interface (available if IO_NEOLED_EN = true) --
244
    neoled_o    => open,                         -- async serial data line
245
 
246
    -- System time --
247
    mtime_i     => (others => '0'),              -- current system time from ext. MTIME (if IO_MTIME_EN = false)
248
    mtime_o     => open,                         -- current system time from int. MTIME (if IO_MTIME_EN = true)
249
 
250
    -- Interrupts --
251
    mtime_irq_i => '0',                          -- machine timer interrupt, available if IO_MTIME_EN = false
252
    msw_irq_i   => '0',                          -- machine software interrupt
253
    mext_irq_i  => '0'                           -- machine external interrupt
254
  );
255
 
256
end architecture;

powered by: WebSVN 2.1.0

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