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

Subversion Repositories neorv32

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

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

powered by: WebSVN 2.1.0

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