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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [docs/] [datasheet/] [overview.adoc] - Blame information for rev 72

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

Line No. Rev Author Line
1 60 zero_gravi
:sectnums:
2
== Overview
3
 
4
The NEORV32footnote:[Pronounced "neo-R-V-thirty-two" or "neo-risc-five-thirty-two" in its long form.] is an open-source
5
RISC-V compatible processor system that is intended as *ready-to-go* auxiliary processor within a larger SoC
6
designs or as stand-alone custom / customizable microcontroller.
7
 
8
The system is highly configurable and provides optional common peripherals like embedded memories,
9
timers, serial interfaces, general purpose IO ports and an external bus interface to connect custom IP like
10
memories, NoCs and other peripherals. On-line and in-system debugging is supported by an OpenOCD/gdb
11
compatible on-chip debugger accessible via JTAG.
12
 
13 66 zero_gravi
Special focus is paid on **execution safety** to provide defined and predictable behavior at any time.
14
Therefore, the CPU ensures that all memory access are acknowledged and no invalid/malformed instructions
15
are executed. Whenever an unexpected situation occurs, the application code is informed via hardware exceptions.
16
 
17 60 zero_gravi
The software framework of the processor comes with application makefiles, software libraries for all CPU
18 65 zero_gravi
and processor features, a bootloader, a runtime environment and several example programs - including a port
19 60 zero_gravi
of the CoreMark MCU benchmark and the official RISC-V architecture test suite. RISC-V GCC is used as
20
default toolchain (https://github.com/stnolting/riscv-gcc-prebuilt[prebuilt toolchains are also provided]).
21
 
22
[TIP]
23 61 zero_gravi
Check out the processor's **https://stnolting.github.io/neorv32/ug[online User Guide]**
24 70 zero_gravi
that provides hands-on tutorials to get you started.
25 72 zero_gravi
The project's change log is available in https://github.com/stnolting/neorv32/blob/main/CHANGELOG.md[CHANGELOG.md]
26 60 zero_gravi
in the root directory of the NEORV32 repository. Please also check out the <<_legal>> section.
27
 
28
 
29 61 zero_gravi
**Structure**
30 60 zero_gravi
 
31 65 zero_gravi
[start=2]
32 64 zero_gravi
. <<_neorv32_processor_soc>>
33
. <<_neorv32_central_processing_unit_cpu>>
34 65 zero_gravi
. <<_software_framework>>
35 64 zero_gravi
. <<_on_chip_debugger_ocd>>
36 60 zero_gravi
 
37
 
38
 
39 61 zero_gravi
<<<
40
// ####################################################################################################################
41 60 zero_gravi
 
42 71 zero_gravi
include::rationale.adoc[]
43 60 zero_gravi
 
44
 
45
 
46
// ####################################################################################################################
47
:sectnums:
48
=== Project Key Features
49
 
50 61 zero_gravi
* open-source and documented; including user guides to get started
51
* completely described in behavioral, platform-independent VHDL (yet platform-optimized modules are provided)
52
* fully synchronous design, no latches, no gated clocks
53
* small hardware footprint and high operating frequency for easy integration
54
* **NEORV32 CPU**: 32-bit `rv32i` RISC-V CPU
55
** RISC-V compatibility: passes the official architecture tests
56
** base architecture + privileged architecture (optional) + ISA extensions (optional)
57 72 zero_gravi
** option to add custom RISC-V instructions (as custom ISA extension)
58 61 zero_gravi
** rich set of customization options (ISA extensions, design goal: performance / area (/ energy), ...)
59 62 zero_gravi
** aims to support <<_full_virtualization>> capabilities (CPU _and_ SoC) to increase execution safety
60 61 zero_gravi
** official https://github.com/riscv/riscv-isa-manual/blob/master/marchid.md[RISC-V open source architecture ID]
61
* **NEORV32 Processor (SoC)**: highly-configurable full-scale microcontroller-like processor system
62
** based on the NEORV32 CPU
63
** optional serial interfaces (UARTs, TWI, SPI)
64
** optional timers and counters (WDT, MTIME)
65
** optional general purpose IO and PWM and native NeoPixel (c) compatible smart LED interface
66
** optional embedded memories / caches for data, instructions and bootloader
67
** optional external memory interface (Wishbone / AXI4-Lite) and stream link interface (AXI4-Stream) for custom connectivity
68 70 zero_gravi
** optional execute in place (XIP) module
69 72 zero_gravi
** on-chip debugger compatible with OpenOCD and gdb including hardware trigger module
70 60 zero_gravi
* **Software framework**
71
** GCC-based toolchain - prebuilt toolchains available; application compilation based on GNU makefiles
72
** internal bootloader with serial user interface
73
** core libraries for high-level usage of the provided functions and peripherals
74
** runtime environment and several example programs
75
** doxygen-based documentation of the software framework; a deployed version is available at https://stnolting.github.io/neorv32/sw/files.html
76
** FreeRTOS port + demos available
77
 
78 61 zero_gravi
[TIP]
79
For more in-depth details regarding the feature provided by he hardware see the according sections:
80
<<_neorv32_central_processing_unit_cpu>> and <<_neorv32_processor_soc>>.
81 60 zero_gravi
 
82 72 zero_gravi
**Extensibility and Customization**
83 61 zero_gravi
 
84 72 zero_gravi
The NEORV32 processor was designed to ease customization and extensibility and provides several options for adding
85
application-specific custom hardware modules and accelerators. The three most common options for adding custom
86
on-chip modules are listed below.
87
 
88
* <<_processor_external_memory_interface_wishbone_axi4_lite>> for processor-external modules
89
* <<_custom_functions_subsystem_cfs>> for tightly-coupled processor-internal co-processors
90
* <<_custom_functions_unit_cfu>> for custom RISC-V instructions
91
 
92
[TIP]
93
A more detailed comparison of the extension/customization options can be found in section
94
https://stnolting.github.io/neorv32/ug/#_adding_custom_hardware_modules[Adding Custom Hardware Modules]
95
of the user guide.
96
 
97
 
98 60 zero_gravi
<<<
99
// ####################################################################################################################
100
:sectnums:
101
=== Project Folder Structure
102
 
103
...................................
104 63 zero_gravi
neorv32                - Project home folder
105 62 zero_gravi
106 63 zero_gravi
├docs                  - Project documentation
107 66 zero_gravi
│├datasheet            - AsciiDoc sources for the NEORV32 data sheet
108 63 zero_gravi
│├figures              - Figures and logos
109
│├icons                - Misc. symbols
110
│├references           - Data sheets and RISC-V specs.
111 66 zero_gravi
│└userguide            - AsciiDoc sources for the NEORV32 user guide
112 62 zero_gravi
113 63 zero_gravi
├rtl                   - VHDL sources
114
│├core                 - Core sources of the CPU & SoC
115 64 zero_gravi
││└mem                 - SoC-internal memories (default architectures)
116 63 zero_gravi
│├processor_templates  - Pre-configured SoC wrappers
117
│├system_integration   - System wrappers for advanced connectivity
118
│└test_setups          - Minimal test setup "SoCs" used in the User Guide
119 62 zero_gravi
120 63 zero_gravi
├sim                   - Simulation files (see User Guide)
121 62 zero_gravi
122 63 zero_gravi
└sw                    - Software framework
123 66 zero_gravi
 ├bootloader           - Sources of the processor-internal bootloader
124
 ├common               - Linker script, crt0.S start-up code and central makefile
125 63 zero_gravi
 ├example              - Various example programs
126 60 zero_gravi
 │└...
127 69 zero_gravi
 ├lib                  - Processor core library
128
 │├include             - Header files (*.h)
129
 │└source              - Source files (*.c)
130
 ├image_gen            - Helper program to generate NEORV32 executables
131 62 zero_gravi
 ├isa-test
132 63 zero_gravi
 │├riscv-arch-test     - RISC-V spec. compatibility test framework (submodule)
133
 │└port-neorv32        - Port files for the official RISC-V architecture tests
134 66 zero_gravi
 ├ocd_firmware         - Source code for on-chip debugger's "park loop"
135 63 zero_gravi
 ├openocd              - OpenOCD on-chip debugger configuration files
136 69 zero_gravi
 └svd                  - Processor system view description file (CMSIS-SVD)
137 60 zero_gravi
...................................
138
 
139
 
140
 
141
<<<
142
// ####################################################################################################################
143
:sectnums:
144
=== VHDL File Hierarchy
145
 
146 68 zero_gravi
All necessary VHDL hardware description files are located in the project's `rtl/core` folder. The top entity
147 60 zero_gravi
of the entire processor including all the required configuration generics is **`neorv32_top.vhd`**.
148
 
149
[IMPORTANT]
150
All core VHDL files from the list below have to be assigned to a new design library named **`neorv32`**. Additional
151
files, like alternative top entities, can be assigned to any library.
152
 
153
...................................
154 61 zero_gravi
neorv32_top.vhd                  - NEORV32 Processor top entity
155
156
├neorv32_fifo.vhd                - General purpose FIFO component
157
├neorv32_package.vhd             - Processor/CPU main VHDL package file
158
159
├neorv32_cpu.vhd                 - NEORV32 CPU top entity
160
│├neorv32_cpu_alu.vhd            - Arithmetic/logic unit
161 63 zero_gravi
││├neorv32_cpu_cp_bitmanip.vhd   - Bit-manipulation co-processor (B ext.)
162 72 zero_gravi
││├neorv32_cpu_cp_cfu.vhd        - Custom functions (instruction) co-processor (Zxcfu ext.)
163 61 zero_gravi
││├neorv32_cpu_cp_fpu.vhd        - Floating-point co-processor (Zfinx ext.)
164
││├neorv32_cpu_cp_muldiv.vhd     - Mul/Div co-processor (M extension)
165
││└neorv32_cpu_cp_shifter.vhd    - Bit-shift co-processor
166
│├neorv32_cpu_bus.vhd            - Bus interface + physical memory protection
167
│├neorv32_cpu_control.vhd        - CPU control, exception/IRQ system and CSRs
168
││└neorv32_cpu_decompressor.vhd  - Compressed instructions decoder
169
│└neorv32_cpu_regfile.vhd        - Data register file
170
171
├neorv32_boot_rom.vhd            - Bootloader ROM
172
│└neorv32_bootloader_image.vhd   - Bootloader boot ROM memory image
173
├neorv32_busswitch.vhd           - Processor bus switch for CPU buses (I&D)
174
├neorv32_bus_keeper.vhd          - Processor-internal bus monitor
175
├neorv32_cfs.vhd                 - Custom functions subsystem
176
├neorv32_debug_dm.vhd            - on-chip debugger: debug module
177
├neorv32_debug_dtm.vhd           - on-chip debugger: debug transfer module
178 64 zero_gravi
├neorv32_dmem.entity.vhd         - Processor-internal data memory (entity-only!)
179 61 zero_gravi
├neorv32_gpio.vhd                - General purpose input/output port unit
180 67 zero_gravi
├neorv32_gptmr.vhd               - General purpose 32-bit timer
181 62 zero_gravi
├neorv32_icache.vhd              - Processor-internal instruction cache
182 64 zero_gravi
├neorv32_imem.entity.vhd         - Processor-internal instruction memory (entity-only!)
183 61 zero_gravi
│└neor32_application_image.vhd   - IMEM application initialization image
184
├neorv32_mtime.vhd               - Machine system timer
185
├neorv32_neoled.vhd              - NeoPixel (TM) compatible smart LED interface
186
├neorv32_pwm.vhd                 - Pulse-width modulation controller
187 67 zero_gravi
├neorv32_slink.vhd               - Stream link controller
188 61 zero_gravi
├neorv32_spi.vhd                 - Serial peripheral interface controller
189
├neorv32_sysinfo.vhd             - System configuration information memory
190
├neorv32_trng.vhd                - True random number generator
191
├neorv32_twi.vhd                 - Two wire serial interface controller
192
├neorv32_uart.vhd                - Universal async. receiver/transmitter
193
├neorv32_wdt.vhd                 - Watchdog timer
194
├neorv32_wishbone.vhd            - External (Wishbone) bus interface
195 70 zero_gravi
├neorv32_xip.vhd                 - Execute in place module
196 67 zero_gravi
├neorv32_xirq.vhd                - External interrupt controller
197 64 zero_gravi
198 68 zero_gravi
├mem/neorv32_dmem.default.vhd    - _Default_ data memory (architecture-only)
199
└mem/neorv32_imem.default.vhd    - _Default_ instruction memory (architecture-only)
200 60 zero_gravi
...................................
201
 
202 64 zero_gravi
[NOTE]
203
The processor-internal instruction and data memories (IMEM and DMEM) are split into two design files each:
204
a plain entity definition (`neorv32_*mem.entity.vhd`) and the actual architecture definition
205 68 zero_gravi
(`mem/neorv32_*mem.default.vhd`). The `*.default.vhd` architecture definitions from `rtl/core/mem` provide a _generic_ and
206 64 zero_gravi
_platform independent_ memory design that (should) infers embedded memory blocks. You can replace/modify the architecture
207
source file in order to use platform-specific features (like advanced memory resources) or to improve technology mapping
208
and/or timing.
209 60 zero_gravi
 
210 64 zero_gravi
 
211 60 zero_gravi
<<<
212
// ####################################################################################################################
213
:sectnums:
214
=== FPGA Implementation Results
215
 
216 62 zero_gravi
This chapter shows _exemplary_ implementation results of the NEORV32 CPU and NEORV32 Processor.
217 60 zero_gravi
 
218
:sectnums:
219
==== CPU
220
 
221
[cols="<2,<8"]
222
[grid="topbot"]
223
|=======================
224 70 zero_gravi
| Top entity: | `rtl/core/neorv32_cpu.vhd`
225
| FPGA:       | Intel Cyclone IV E `EP4CE22F17C6`
226
| Toolchain:  | Quartus Prime 20.1.0
227 60 zero_gravi
|=======================
228
 
229
[cols="<5,>1,>1,>1,>1,>1"]
230
[options="header",grid="rows"]
231
|=======================
232 66 zero_gravi
| CPU                                               | LEs  | FFs  | MEM bits | DSPs | _f~max~_
233
| `rv32i`                                           |  806 |  359 |     1024 |    0 | 125 MHz
234
| `rv32i_Zicsr_Zicntr`                              | 1729 |  813 |     1024 |    0 | 124 MHz
235
| `rv32im_Zicsr_Zicntr`                             | 2269 | 1055 |     1024 |    0 | 124 MHz
236
| `rv32imc_Zicsr_Zicntr`                            | 2501 | 1070 |     1024 |    0 | 124 MHz
237
| `rv32imac_Zicsr_Zicntr`                           | 2511 | 1074 |     1024 |    0 | 124 MHz
238
| `rv32imacu_Zicsr_Zicntr`                          | 2521 | 1079 |     1024 |    0 | 124 MHz
239
| `rv32imacu_Zicsr_Zicntr_Zifencei`                 | 2522 | 1079 |     1024 |    0 | 122 MHz
240
| `rv32imacu_Zicsr_Zicntr_Zifencei_Zfinx`           | 3807 | 1731 |     1024 |    7 | 116 MHz
241
| `rv32imacu_Zicsr_Zicntr_Zifencei_Zfinx_DebugMode` | 3974 | 1815 |     1024 |    7 | 116 MHz
242 60 zero_gravi
|=======================
243
 
244 62 zero_gravi
[TIP]
245
The CPU provides further options to reduce the area footprint (for example by constraining the CPU-internal
246
counter sizes) or to increase performance (for example by using a barrel-shifter; at cost of extra hardware).
247 63 zero_gravi
See section <<_processor_top_entity_generics>> for more information. Also, take a look at the User Guide section
248
https://stnolting.github.io/neorv32/ug/#_application_specific_processor_configuration[Application-Specific Processor Configuration].
249 62 zero_gravi
 
250
 
251 60 zero_gravi
:sectnums:
252
==== Processor Modules
253
 
254
[cols="<2,<8"]
255
[grid="topbot"]
256
|=======================
257 70 zero_gravi
| Top entity: | `rtl/core/neorv32_top.vhd`
258
| FPGA:       | Intel Cyclone IV E `EP4CE22F17C6`
259
| Toolchain:  | Quartus Prime 20.1.0
260 60 zero_gravi
|=======================
261
 
262
.Hardware utilization by the processor modules (mandatory core modules in **bold**)
263
[cols="<2,<8,>1,>1,>2,>1"]
264
[options="header",grid="rows"]
265
|=======================
266 62 zero_gravi
| Module        | Description                                           | LEs | FFs | MEM bits | DSPs
267
| Boot ROM      | Bootloader ROM (4kB)                                  |   2 |   1 |    32768 |    0
268
| **BUSKEEPER** | Processor-internal bus monitor                        |   9 |   6 |        0 |    0
269 70 zero_gravi
| **BUSSWITCH** | Bus multiplexer for CPU instr. and data interface     |  63 |   8 |        0 |    0
270 61 zero_gravi
| CFS           | Custom functions subsystemfootnote:[Resource utilization depends on actually implemented custom functionality.] | - | - | - | -
271 62 zero_gravi
| DMEM          | Processor-internal data memory (8kB)                  |  19 |   2 |    65536 |    0
272
| DM            | On-chip debugger - debug module                       | 493 | 240 |        0 |    0
273
| DTM           | On-chip debugger - debug transfer module (JTAG)       | 254 | 218 |        0 |    0
274
| GPIO          | General purpose input/output ports                    | 134 | 161 |        0 |    0
275
| iCACHE        | Instruction cache (1x4 blocks, 256 bytes per block)   | 2 21| 156 |     8192 |    0
276
| IMEM          | Processor-internal instruction memory (16kB)          |  13 |   2 |   131072 |    0
277
| MTIME         | Machine system timer                                  | 319 | 167 |        0 |    0
278
| NEOLED        | Smart LED Interface (NeoPixel/WS28128) [FIFO_depth=1] | 226 | 182 |        0 |    0
279
| SLINK         | Stream link interface (2xRX, 2xTX, FIFO_depth=1)      | 208 | 181 |        0 |    0
280
| PWM           | Pulse_width modulation controller (4 channels)        |  71 |  69 |        0 |    0
281
| SPI           | Serial peripheral interface                           | 148 | 127 |        0 |    0
282
| **SYSINFO**   | System configuration information memory               |  14 |  11 |        0 |    0
283
| TRNG          | True random number generator                          |  89 |  76 |        0 |    0
284
| TWI           | Two-wire interface                                    |  77 |  43 |        0 |    0
285
| UART0/1       | Universal asynchronous receiver/transmitter 0/1       | 183 | 132 |        0 |    0
286
| WDT           | Watchdog timer                                        |  53 |  43 |        0 |    0
287
| WISHBONE      | External memory interface                             | 114 | 110 |        0 |    0
288
| XIRQ          | External interrupt controller (32 channels)           | 241 | 201 |        0 |    0
289 67 zero_gravi
| GPTMR         | General Purpose Timer                                 | 153 | 107 |        0 |    0
290 70 zero_gravi
| XIP           | Execute in place module                               | 305 | 243 |        0 |    0
291 60 zero_gravi
|=======================
292
 
293
 
294
<<<
295
:sectnums:
296
==== Exemplary Setups
297
 
298 71 zero_gravi
Check out the `neorv32-setups` repository (@GitHub: https://github.com/stnolting/neorv32-setups),
299 61 zero_gravi
which provides several demo setups for various FPGA boards and toolchains.
300 60 zero_gravi
 
301
 
302
<<<
303
// ####################################################################################################################
304
:sectnums:
305
=== CPU Performance
306
 
307 62 zero_gravi
The performance of the NEORV32 was tested and evaluated using the https://www.eembc.org/coremark/[Core Mark CPU benchmark].
308
This benchmark focuses on testing the capabilities of the CPU core itself rather than the performance of the whole
309
system. The according sources can be found in the `sw/example/coremark` folder.
310 60 zero_gravi
 
311 63 zero_gravi
.Dhrystone
312
[TIP]
313
A _simple_ port of the Dhrystone benchmark is also available in `sw/example/dhrystone`.
314
 
315 60 zero_gravi
The resulting CoreMark score is defined as CoreMark iterations per second.
316
The execution time is determined via the RISC-V `[m]cycle[h]` CSRs. The relative CoreMark score is
317
defined as CoreMark score divided by the CPU's clock frequency in MHz.
318
 
319 62 zero_gravi
.Configuration
320 60 zero_gravi
[cols="<2,<8"]
321
[grid="topbot"]
322
|=======================
323 62 zero_gravi
| HW version:     | `1.5.7.10`
324
| Hardware:       | 32kB int. IMEM, 16kB int. DMEM, no caches, 100MHz clock
325
| CoreMark:       | 2000 iterations, MEM_METHOD is MEM_STACK
326
| Compiler:       | RISCV32-GCC 10.2.0
327
| Compiler flags: | default, see makefile
328 60 zero_gravi
|=======================
329
 
330
.CoreMark results
331 62 zero_gravi
[cols="<4,^1,^1,^1"]
332 60 zero_gravi
[options="header",grid="rows"]
333
|=======================
334 66 zero_gravi
| CPU                                             | CoreMark Score | CoreMarks/MHz | Average CPI
335
| _small_ (`rv32i_Zicsr`)                         |          33.89 | **0.3389**    | **4.04**
336
| _medium_ (`rv32imc_Zicsr`)                      |          62.50 | **0.6250**    | **5.34**
337
| _performance_ (`rv32imc_Zicsr` + perf. options) |          95.23 | **0.9523**    | **3.54**
338 60 zero_gravi
|=======================
339
 
340 71 zero_gravi
[IMPORTANT]
341
The CoreMark results were generated using a `rv32i` toolchain. This toolchain supports standard extensions
342
like `M` and `C` but the built-in libraries only use the base `I` ISA.
343
 
344 60 zero_gravi
[NOTE]
345 62 zero_gravi
The "_performance_" CPU configuration uses the <<_fast_mul_en>> and <<_fast_shift_en>> options.
346 60 zero_gravi
 
347 62 zero_gravi
[NOTE]
348 60 zero_gravi
The NEORV32 CPU is based on a multi-cycle architecture. Each instruction is executed in a sequence of
349 62 zero_gravi
several consecutive micro operations.
350 60 zero_gravi
 
351 62 zero_gravi
[NOTE]
352 60 zero_gravi
The average CPI (cycles per instruction) depends on the instruction mix of a specific applications and also on
353 62 zero_gravi
the available CPU extensions. The average CPI is computed by dividing the total number of required clock cycles
354
(only the timed core to avoid distortion due to IO wait cycles) by the number of executed instructions
355
(`[m]instret[h]` CSRs).
356 60 zero_gravi
 
357
[TIP]
358
More information regarding the execution time of each implemented instruction can be found in
359
chapter <<_instruction_timing>>.

powered by: WebSVN 2.1.0

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