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

Subversion Repositories neorv32

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

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 74 zero_gravi
 ├image_gen            - Helper program to generate NEORV32 executables^
143 66 zero_gravi
 ├ocd_firmware         - Source code for on-chip debugger's "park loop"
144 63 zero_gravi
 ├openocd              - OpenOCD on-chip debugger configuration files
145 69 zero_gravi
 └svd                  - Processor system view description file (CMSIS-SVD)
146 60 zero_gravi
...................................
147
 
148
 
149
 
150
<<<
151
// ####################################################################################################################
152
:sectnums:
153
=== VHDL File Hierarchy
154
 
155 68 zero_gravi
All necessary VHDL hardware description files are located in the project's `rtl/core` folder. The top entity
156 60 zero_gravi
of the entire processor including all the required configuration generics is **`neorv32_top.vhd`**.
157
 
158
[IMPORTANT]
159
All core VHDL files from the list below have to be assigned to a new design library named **`neorv32`**. Additional
160
files, like alternative top entities, can be assigned to any library.
161
 
162
...................................
163 61 zero_gravi
neorv32_top.vhd                  - NEORV32 Processor top entity
164
165
├neorv32_fifo.vhd                - General purpose FIFO component
166
├neorv32_package.vhd             - Processor/CPU main VHDL package file
167
168
├neorv32_cpu.vhd                 - NEORV32 CPU top entity
169
│├neorv32_cpu_alu.vhd            - Arithmetic/logic unit
170 63 zero_gravi
││├neorv32_cpu_cp_bitmanip.vhd   - Bit-manipulation co-processor (B ext.)
171 72 zero_gravi
││├neorv32_cpu_cp_cfu.vhd        - Custom functions (instruction) co-processor (Zxcfu ext.)
172 61 zero_gravi
││├neorv32_cpu_cp_fpu.vhd        - Floating-point co-processor (Zfinx ext.)
173
││├neorv32_cpu_cp_muldiv.vhd     - Mul/Div co-processor (M extension)
174
││└neorv32_cpu_cp_shifter.vhd    - Bit-shift co-processor
175
│├neorv32_cpu_bus.vhd            - Bus interface + physical memory protection
176
│├neorv32_cpu_control.vhd        - CPU control, exception/IRQ system and CSRs
177
││└neorv32_cpu_decompressor.vhd  - Compressed instructions decoder
178
│└neorv32_cpu_regfile.vhd        - Data register file
179
180
├neorv32_boot_rom.vhd            - Bootloader ROM
181
│└neorv32_bootloader_image.vhd   - Bootloader boot ROM memory image
182
├neorv32_busswitch.vhd           - Processor bus switch for CPU buses (I&D)
183
├neorv32_bus_keeper.vhd          - Processor-internal bus monitor
184
├neorv32_cfs.vhd                 - Custom functions subsystem
185
├neorv32_debug_dm.vhd            - on-chip debugger: debug module
186
├neorv32_debug_dtm.vhd           - on-chip debugger: debug transfer module
187 64 zero_gravi
├neorv32_dmem.entity.vhd         - Processor-internal data memory (entity-only!)
188 61 zero_gravi
├neorv32_gpio.vhd                - General purpose input/output port unit
189 67 zero_gravi
├neorv32_gptmr.vhd               - General purpose 32-bit timer
190 62 zero_gravi
├neorv32_icache.vhd              - Processor-internal instruction cache
191 64 zero_gravi
├neorv32_imem.entity.vhd         - Processor-internal instruction memory (entity-only!)
192 61 zero_gravi
│└neor32_application_image.vhd   - IMEM application initialization image
193
├neorv32_mtime.vhd               - Machine system timer
194
├neorv32_neoled.vhd              - NeoPixel (TM) compatible smart LED interface
195
├neorv32_pwm.vhd                 - Pulse-width modulation controller
196 67 zero_gravi
├neorv32_slink.vhd               - Stream link controller
197 61 zero_gravi
├neorv32_spi.vhd                 - Serial peripheral interface controller
198
├neorv32_sysinfo.vhd             - System configuration information memory
199
├neorv32_trng.vhd                - True random number generator
200
├neorv32_twi.vhd                 - Two wire serial interface controller
201
├neorv32_uart.vhd                - Universal async. receiver/transmitter
202
├neorv32_wdt.vhd                 - Watchdog timer
203
├neorv32_wishbone.vhd            - External (Wishbone) bus interface
204 70 zero_gravi
├neorv32_xip.vhd                 - Execute in place module
205 67 zero_gravi
├neorv32_xirq.vhd                - External interrupt controller
206 64 zero_gravi
207 68 zero_gravi
├mem/neorv32_dmem.default.vhd    - _Default_ data memory (architecture-only)
208
└mem/neorv32_imem.default.vhd    - _Default_ instruction memory (architecture-only)
209 60 zero_gravi
...................................
210
 
211 64 zero_gravi
[NOTE]
212
The processor-internal instruction and data memories (IMEM and DMEM) are split into two design files each:
213
a plain entity definition (`neorv32_*mem.entity.vhd`) and the actual architecture definition
214 68 zero_gravi
(`mem/neorv32_*mem.default.vhd`). The `*.default.vhd` architecture definitions from `rtl/core/mem` provide a _generic_ and
215 64 zero_gravi
_platform independent_ memory design that (should) infers embedded memory blocks. You can replace/modify the architecture
216
source file in order to use platform-specific features (like advanced memory resources) or to improve technology mapping
217
and/or timing.
218 60 zero_gravi
 
219 64 zero_gravi
 
220 60 zero_gravi
<<<
221
// ####################################################################################################################
222
:sectnums:
223
=== FPGA Implementation Results
224
 
225 73 zero_gravi
This section shows _exemplary_ FPGA implementation results for the NEORV32 CPU and NEORV32 Processor modules.
226
Note that certain configuration options might also have an impact on other configuration options. Furthermore,
227
this report cannot cover all possible option combinations. Hence, the presented implementation results are
228
just _exemplary_. If not otherwise mentioned all implementations use the default generic configurations.
229 60 zero_gravi
 
230
:sectnums:
231
==== CPU
232
 
233
[cols="<2,<8"]
234
[grid="topbot"]
235
|=======================
236 74 zero_gravi
| HW version:  | `1.6.9.8`
237 73 zero_gravi
| Top entity:  | `rtl/core/neorv32_cpu.vhd`
238
| FPGA:        | Intel Cyclone IV E `EP4CE22F17C6`
239
| Toolchain:   | Quartus Prime Lite 21.1
240
| Constraints: | **no timing constraints**, "_balanced optimization_", f~max~ from "_Slow 1200mV 0C Model_"
241 60 zero_gravi
|=======================
242
 
243 73 zero_gravi
[cols="<6,>1,>1,>1,>1,>1"]
244 60 zero_gravi
[options="header",grid="rows"]
245
|=======================
246 73 zero_gravi
| CPU ISA Configuration                              | LEs  | FFs  | MEM bits | DSPs | _f~max~_
247 74 zero_gravi
| `rv32e`                                            |  830 |  400 |      512 |    0 | 129 MHz
248
| `rv32i`                                            |  834 |  400 |     1024 |    0 | 129 MHz
249
| `rv32i_Zicsr`                                      | 1328 |  678 |     1024 |    0 | 128 MHz
250
| `rv32i_Zicsr_Zicntr`                               | 1614 |  808 |     1024 |    0 | 128 MHz
251
| `rv32im_Zicsr_Zicntr`                              | 2087 |  983 |     1024 |    0 | 128 MHz
252
| `rv32ima_Zicsr_Zicntr`                             | 2129 |  987 |     1024 |    0 | 128 MHz
253
| `rv32imac_Zicsr_Zicntr`                            | 2338 |  992 |     1024 |    0 | 128 MHz
254
| `rv32imacb_Zicsr_Zicntr`                           | 3175 | 1247 |     1024 |    0 | 128 MHz
255
| `rv32imacbu_Zicsr_Zicntr`                          | 3186 | 1254 |     1024 |    0 | 128 MHz
256
| `rv32imacbu_Zicsr_Zicntr_Zifencei`                 | 3187 | 1254 |     1024 |    0 | 128 MHz
257
| `rv32imacbu_Zicsr_Zicntr_Zifencei_Zfinx`           | 4450 | 1906 |     1024 |    7 | 123 MHz
258
| `rv32imacbu_Zicsr_Zicntr_Zifencei_Zfinx_DebugMode` | 4825 | 2018 |     1024 |    7 | 123 MHz
259 60 zero_gravi
|=======================
260
 
261 73 zero_gravi
.**RISC-V Compliance**
262
[NOTE]
263
The `Zicsr` ISA extension implements the privileged machine architecture
264
(see <<_zicsr_control_and_status_register_access_privileged_architecture>>). The `Zicntr` ISA
265
extension implements the basic counters and timers (see <<_zicntr_cpu_base_counters>>). Both
266
extensions are _mandatory_ in order to comply with the RISC-V architecture specifications.
267
 
268
[NOTE]
269
The table above does not show _all_ CPU ISA extensions. More sophisticated and application-specific
270
options like PMP and HMP are not included in this overview.
271
 
272
.Goal-Driven Optimization
273 62 zero_gravi
[TIP]
274
The CPU provides further options to reduce the area footprint (for example by constraining the CPU-internal
275
counter sizes) or to increase performance (for example by using a barrel-shifter; at cost of extra hardware).
276 63 zero_gravi
See section <<_processor_top_entity_generics>> for more information. Also, take a look at the User Guide section
277
https://stnolting.github.io/neorv32/ug/#_application_specific_processor_configuration[Application-Specific Processor Configuration].
278 62 zero_gravi
 
279
 
280 60 zero_gravi
:sectnums:
281 73 zero_gravi
==== Processor - Modules
282 60 zero_gravi
 
283
[cols="<2,<8"]
284
[grid="topbot"]
285
|=======================
286 73 zero_gravi
| HW version: | `1.6.8.3`
287 70 zero_gravi
| Top entity: | `rtl/core/neorv32_top.vhd`
288
| FPGA:       | Intel Cyclone IV E `EP4CE22F17C6`
289 73 zero_gravi
| Toolchain:  | Quartus Prime Lite 21.1
290
| Constraints: | **no timing constraints**, "_balanced optimization_"
291 60 zero_gravi
|=======================
292
 
293 73 zero_gravi
.Hardware utilization by processor module (mandatory modules highlighted in **bold**)
294 60 zero_gravi
[cols="<2,<8,>1,>1,>2,>1"]
295
[options="header",grid="rows"]
296
|=======================
297 73 zero_gravi
| Module        | Description                                                    | LEs | FFs | MEM bits | DSPs
298
| Boot ROM      | Bootloader ROM (4kB)                                           |   3 |   2 |    32768 |    0
299
| **BUSKEEPER** | Processor-internal bus monitor                                 |  28 |  15 |        0 |    0
300
| **BUSSWITCH** | Bus multiplexer for CPU instr. and data interface              |  69 |   8 |        0 |    0
301
| CFS           | Custom functions subsystemfootnote:[Resource utilization depends on custom design logic.] | - | - | - | -
302
| DM            | On-chip debugger - debug module                                | 473 | 240 |        0 |    0
303
| DTM           | On-chip debugger - debug transfer module (JTAG)                | 259 | 221 |        0 |    0
304
| DMEM          | Processor-internal data memory (8kB)                           |  18 |   2 |    65536 |    0
305
| GPIO          | General purpose input/output ports                             | 102 |  98 |        0 |    0
306
| GPTMR         | General Purpose Timer                                          | 153 | 105 |        0 |    0
307
| iCACHE        | Instruction cache (2x4 blocks, 64 bytes per block)             | 417 | 297 |     4096 |    0
308
| IMEM          | Processor-internal instruction memory (16kB)                   |  12 |   2 |   131072 |    0
309
| MTIME         | Machine system timer                                           | 345 | 166 |        0 |    0
310
| NEOLED        | Smart LED Interface (NeoPixel/WS28128) (FIFO_depth=1)          | 227 | 184 |        0 |    0
311
| PWM           | Pulse_width modulation controller (8 channels)                 | 128 | qq7 |        0 |    0
312
| SLINK         | Stream link interface (2xRX, 2xTX, FIFO_depth=1)               | 136 | 116 |        0 |    0
313
| SPI           | Serial peripheral interface                                    | 114 |  94 |        0 |    0
314
| **SYSINFO**   | System configuration information memory                        |  13 |  11 |        0 |    0
315
| TRNG          | True random number generator                                   |  89 |  79 |        0 |    0
316
| TWI           | Two-wire interface                                             |  77 |  43 |        0 |    0
317
| UART0, UART1  | Universal asynchronous receiver/transmitter 0/1 (FIFO_depth=1) | 195 | 143 |        0 |    0
318
| WDT           | Watchdog timer                                                 |  61 |  46 |        0 |    0
319
| WISHBONE      | External memory interface                                      | 120 | 112 |        0 |    0
320
| XIP           | Execute in place module                                        | 318 | 244 |        0 |    0
321
| XIRQ          | External interrupt controller (32 channels)                    | 245 | 200 |        0 |    0
322 60 zero_gravi
|=======================
323
 
324 73 zero_gravi
[NOTE]
325
Note that not all IOs were actually connected to FPGA pins (for example some GPIO inputs and outputs)
326
when generating these reports.
327 60 zero_gravi
 
328 73 zero_gravi
 
329 60 zero_gravi
<<<
330
:sectnums:
331
==== Exemplary Setups
332
 
333 71 zero_gravi
Check out the `neorv32-setups` repository (@GitHub: https://github.com/stnolting/neorv32-setups),
334 61 zero_gravi
which provides several demo setups for various FPGA boards and toolchains.
335 60 zero_gravi
 
336
 
337
<<<
338
// ####################################################################################################################
339
:sectnums:
340
=== CPU Performance
341
 
342 62 zero_gravi
The performance of the NEORV32 was tested and evaluated using the https://www.eembc.org/coremark/[Core Mark CPU benchmark].
343
This benchmark focuses on testing the capabilities of the CPU core itself rather than the performance of the whole
344
system. The according sources can be found in the `sw/example/coremark` folder.
345 60 zero_gravi
 
346 63 zero_gravi
.Dhrystone
347
[TIP]
348
A _simple_ port of the Dhrystone benchmark is also available in `sw/example/dhrystone`.
349
 
350 60 zero_gravi
The resulting CoreMark score is defined as CoreMark iterations per second.
351
The execution time is determined via the RISC-V `[m]cycle[h]` CSRs. The relative CoreMark score is
352
defined as CoreMark score divided by the CPU's clock frequency in MHz.
353
 
354 62 zero_gravi
.Configuration
355 60 zero_gravi
[cols="<2,<8"]
356
[grid="topbot"]
357
|=======================
358 62 zero_gravi
| HW version:     | `1.5.7.10`
359
| Hardware:       | 32kB int. IMEM, 16kB int. DMEM, no caches, 100MHz clock
360
| CoreMark:       | 2000 iterations, MEM_METHOD is MEM_STACK
361
| Compiler:       | RISCV32-GCC 10.2.0
362
| Compiler flags: | default, see makefile
363 60 zero_gravi
|=======================
364
 
365
.CoreMark results
366 62 zero_gravi
[cols="<4,^1,^1,^1"]
367 60 zero_gravi
[options="header",grid="rows"]
368
|=======================
369 66 zero_gravi
| CPU                                             | CoreMark Score | CoreMarks/MHz | Average CPI
370
| _small_ (`rv32i_Zicsr`)                         |          33.89 | **0.3389**    | **4.04**
371
| _medium_ (`rv32imc_Zicsr`)                      |          62.50 | **0.6250**    | **5.34**
372
| _performance_ (`rv32imc_Zicsr` + perf. options) |          95.23 | **0.9523**    | **3.54**
373 60 zero_gravi
|=======================
374
 
375 73 zero_gravi
[NOTE]
376 71 zero_gravi
The CoreMark results were generated using a `rv32i` toolchain. This toolchain supports standard extensions
377
like `M` and `C` but the built-in libraries only use the base `I` ISA.
378
 
379 60 zero_gravi
[NOTE]
380 62 zero_gravi
The "_performance_" CPU configuration uses the <<_fast_mul_en>> and <<_fast_shift_en>> options.
381 60 zero_gravi
 
382
The NEORV32 CPU is based on a multi-cycle architecture. Each instruction is executed in a sequence of
383 62 zero_gravi
several consecutive micro operations.
384 60 zero_gravi
The average CPI (cycles per instruction) depends on the instruction mix of a specific applications and also on
385 62 zero_gravi
the available CPU extensions. The average CPI is computed by dividing the total number of required clock cycles
386
(only the timed core to avoid distortion due to IO wait cycles) by the number of executed instructions
387 73 zero_gravi
(`[m]instret[h]` CSRs). More information regarding the execution time of each implemented instruction can be found in
388 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.