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 |
|
|
that provides hands-on tutorial to get you started.
|
25 |
|
|
|
26 |
|
|
[TIP]
|
27 |
60 |
zero_gravi |
The project's change log is available in https://github.com/stnolting/neorv32/blob/master/CHANGELOG.md[CHANGELOG.md]
|
28 |
|
|
in the root directory of the NEORV32 repository. Please also check out the <<_legal>> section.
|
29 |
|
|
|
30 |
|
|
|
31 |
61 |
zero_gravi |
**Structure**
|
32 |
60 |
zero_gravi |
|
33 |
65 |
zero_gravi |
[start=2]
|
34 |
64 |
zero_gravi |
. <<_neorv32_processor_soc>>
|
35 |
|
|
. <<_neorv32_central_processing_unit_cpu>>
|
36 |
65 |
zero_gravi |
. <<_software_framework>>
|
37 |
64 |
zero_gravi |
. <<_on_chip_debugger_ocd>>
|
38 |
60 |
zero_gravi |
|
39 |
61 |
zero_gravi |
[TIP]
|
40 |
|
|
Links in this document are <<_overview,highlighted>>.
|
41 |
60 |
zero_gravi |
|
42 |
|
|
|
43 |
|
|
|
44 |
61 |
zero_gravi |
<<<
|
45 |
|
|
// ####################################################################################################################
|
46 |
|
|
:sectnums:
|
47 |
|
|
=== Rationale
|
48 |
60 |
zero_gravi |
|
49 |
61 |
zero_gravi |
**Why did you make this?**
|
50 |
60 |
zero_gravi |
|
51 |
61 |
zero_gravi |
I am fascinated by processor and CPU architecture design: it is the magic frontier where software meets hardware.
|
52 |
|
|
This project has started as something like a _journey_ into this magic realm to understand how things actually work
|
53 |
|
|
down on this very low level.
|
54 |
60 |
zero_gravi |
|
55 |
61 |
zero_gravi |
But there is more! When I started to dive into the emerging RISC-V ecosystem I felt overwhelmed by the complexity.
|
56 |
|
|
As a beginner it is hard to get an overview - especially when you want to setup a minimal platform to tinker with:
|
57 |
|
|
Which core to use? How to get the right toolchain? What features do I need? How does the booting work? How do I
|
58 |
|
|
create an actual executable? How to get that into the hardware? How to customize things? **_Where to start???_**
|
59 |
60 |
zero_gravi |
|
60 |
61 |
zero_gravi |
So this project aims to provides a _simple to understand_ and _easy to use_ yet _powerful_ and _flexible_ platform
|
61 |
|
|
that targets FPGA and RISC-V beginners as well as advanced users. Join me and us on this journey! 🙃
|
62 |
60 |
zero_gravi |
|
63 |
|
|
|
64 |
61 |
zero_gravi |
**Why a _soft_-core processor?**
|
65 |
60 |
zero_gravi |
|
66 |
61 |
zero_gravi |
As a matter of fact soft-core processors _cannot_ compete with discrete or FPGA hard-macro processors in terms
|
67 |
|
|
of performance, energy and size. But they do fill a niche in FPGA design space. For example, soft-core processors
|
68 |
|
|
allow to implement the _control flow part_ of certain applications (like communication protocol handling) using
|
69 |
|
|
software like plain C. This provides high flexibility as software can be easily changed, re-compiled and
|
70 |
|
|
re-uploaded again.
|
71 |
60 |
zero_gravi |
|
72 |
61 |
zero_gravi |
Furthermore, the concept of flexibility applies to all aspects of a soft-core processor. The user can add
|
73 |
|
|
_exactly_ the features that are required by the application: additional memories, custom interfaces, specialized
|
74 |
|
|
IP and even user-defined instructions.
|
75 |
60 |
zero_gravi |
|
76 |
|
|
|
77 |
61 |
zero_gravi |
**Why RISC-V?**
|
78 |
|
|
|
79 |
|
|
[quote, RISC-V International, https://riscv.org/about/]
|
80 |
|
|
____
|
81 |
|
|
RISC-V is a free and open ISA enabling a new era of processor innovation through open standard collaboration.
|
82 |
|
|
____
|
83 |
|
|
|
84 |
|
|
I love the idea of open-source. **Knowledge can help best if it is freely available.**
|
85 |
|
|
While open-source has already become quite popular in _software_, hardware projects still need to catch up.
|
86 |
|
|
Admittedly, there has been quite a development, but mainly in terms of _platforms_ and _applications_ (so
|
87 |
|
|
schematics, PCBs, etc.). Although processors and CPUs are the heart of almost every digital system, having a true
|
88 |
|
|
open-source silicon is still a rarity. RISC-V aims to change that. Even it is _just one approach_, it helps paving
|
89 |
|
|
the road for future development.
|
90 |
|
|
|
91 |
|
|
Furthermore, I welcome the community aspect of RISC-V. The ISA and everything beyond is developed with direct
|
92 |
|
|
contact to the community: this includes businesses and professionals but also hobbyist, amateurs and people
|
93 |
|
|
that are just curious. Everyone can join discussions and contribute to RISC-V in their very own way.
|
94 |
|
|
|
95 |
|
|
Finally, I really like the RISC-V ISA itself. It aims to be a clean, orthogonal and "intuitive" ISA that
|
96 |
|
|
resembles with the basic concepts of _RISC_: simple yet effective.
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
**Yet another RISC-V core? What makes it special?**
|
100 |
|
|
|
101 |
|
|
The NEORV32 is not based on another RISC-V core. It was build entirely from ground up (just following the official
|
102 |
|
|
ISA specs) having a different design goal in mind. The project does not intend to replace certain RISC-V cores or
|
103 |
|
|
just beat existing ones like https://github.com/SpinalHDL/VexRiscv[VexRISC] in terms of performance or
|
104 |
|
|
https://github.com/olofk/serv[SERV] in terms of size.
|
105 |
|
|
|
106 |
|
|
The project aims to provide _another option_ in the RISC-V / soft-core design space with a different performance
|
107 |
|
|
vs. size trade-off and a different focus: _embrace_ concepts like documentation, platform-independence / portability,
|
108 |
|
|
RISC-V compatibility, _customization_ and _ease of use_. See the <<_project_key_features>> below.
|
109 |
|
|
|
110 |
68 |
zero_gravi |
Furthermore, the NEORV32 pays special focus on _execution safety_ using <<_full_virtualization>>. The CPU aims to
|
111 |
|
|
provide fall-backs for _everything that could go wrong_. This includes malformed instruction words, privilege escalations
|
112 |
|
|
and even memory accesses that are checked for address space holes and deterministic response times from memory-mapped
|
113 |
|
|
devices. Precise exceptions allow a defined and fully-synchronized state of the CPU at every time.
|
114 |
61 |
zero_gravi |
|
115 |
68 |
zero_gravi |
|
116 |
|
|
|
117 |
60 |
zero_gravi |
// ####################################################################################################################
|
118 |
|
|
:sectnums:
|
119 |
|
|
=== Project Key Features
|
120 |
|
|
|
121 |
61 |
zero_gravi |
* open-source and documented; including user guides to get started
|
122 |
|
|
* completely described in behavioral, platform-independent VHDL (yet platform-optimized modules are provided)
|
123 |
|
|
* fully synchronous design, no latches, no gated clocks
|
124 |
|
|
* small hardware footprint and high operating frequency for easy integration
|
125 |
|
|
* **NEORV32 CPU**: 32-bit `rv32i` RISC-V CPU
|
126 |
|
|
** RISC-V compatibility: passes the official architecture tests
|
127 |
|
|
** base architecture + privileged architecture (optional) + ISA extensions (optional)
|
128 |
|
|
** rich set of customization options (ISA extensions, design goal: performance / area (/ energy), ...)
|
129 |
62 |
zero_gravi |
** aims to support <<_full_virtualization>> capabilities (CPU _and_ SoC) to increase execution safety
|
130 |
61 |
zero_gravi |
** official https://github.com/riscv/riscv-isa-manual/blob/master/marchid.md[RISC-V open source architecture ID]
|
131 |
|
|
* **NEORV32 Processor (SoC)**: highly-configurable full-scale microcontroller-like processor system
|
132 |
|
|
** based on the NEORV32 CPU
|
133 |
|
|
** optional serial interfaces (UARTs, TWI, SPI)
|
134 |
|
|
** optional timers and counters (WDT, MTIME)
|
135 |
|
|
** optional general purpose IO and PWM and native NeoPixel (c) compatible smart LED interface
|
136 |
|
|
** optional embedded memories / caches for data, instructions and bootloader
|
137 |
|
|
** optional external memory interface (Wishbone / AXI4-Lite) and stream link interface (AXI4-Stream) for custom connectivity
|
138 |
|
|
** on-chip debugger compatible with OpenOCD and gdb
|
139 |
60 |
zero_gravi |
* **Software framework**
|
140 |
|
|
** GCC-based toolchain - prebuilt toolchains available; application compilation based on GNU makefiles
|
141 |
|
|
** internal bootloader with serial user interface
|
142 |
|
|
** core libraries for high-level usage of the provided functions and peripherals
|
143 |
|
|
** runtime environment and several example programs
|
144 |
|
|
** doxygen-based documentation of the software framework; a deployed version is available at https://stnolting.github.io/neorv32/sw/files.html
|
145 |
|
|
** FreeRTOS port + demos available
|
146 |
|
|
|
147 |
61 |
zero_gravi |
[TIP]
|
148 |
|
|
For more in-depth details regarding the feature provided by he hardware see the according sections:
|
149 |
|
|
<<_neorv32_central_processing_unit_cpu>> and <<_neorv32_processor_soc>>.
|
150 |
60 |
zero_gravi |
|
151 |
61 |
zero_gravi |
|
152 |
60 |
zero_gravi |
<<<
|
153 |
|
|
// ####################################################################################################################
|
154 |
|
|
:sectnums:
|
155 |
|
|
=== Project Folder Structure
|
156 |
|
|
|
157 |
|
|
...................................
|
158 |
63 |
zero_gravi |
neorv32 - Project home folder
|
159 |
62 |
zero_gravi |
│
|
160 |
63 |
zero_gravi |
├docs - Project documentation
|
161 |
66 |
zero_gravi |
│├datasheet - AsciiDoc sources for the NEORV32 data sheet
|
162 |
63 |
zero_gravi |
│├figures - Figures and logos
|
163 |
|
|
│├icons - Misc. symbols
|
164 |
|
|
│├references - Data sheets and RISC-V specs.
|
165 |
66 |
zero_gravi |
│└userguide - AsciiDoc sources for the NEORV32 user guide
|
166 |
62 |
zero_gravi |
│
|
167 |
63 |
zero_gravi |
├rtl - VHDL sources
|
168 |
|
|
│├core - Core sources of the CPU & SoC
|
169 |
64 |
zero_gravi |
││└mem - SoC-internal memories (default architectures)
|
170 |
63 |
zero_gravi |
│├processor_templates - Pre-configured SoC wrappers
|
171 |
|
|
│├system_integration - System wrappers for advanced connectivity
|
172 |
|
|
│└test_setups - Minimal test setup "SoCs" used in the User Guide
|
173 |
62 |
zero_gravi |
│
|
174 |
63 |
zero_gravi |
├setups - Example setups for various FPGAs, boards and toolchains
|
175 |
61 |
zero_gravi |
│└...
|
176 |
62 |
zero_gravi |
│
|
177 |
63 |
zero_gravi |
├sim - Simulation files (see User Guide)
|
178 |
62 |
zero_gravi |
│
|
179 |
63 |
zero_gravi |
└sw - Software framework
|
180 |
66 |
zero_gravi |
├bootloader - Sources of the processor-internal bootloader
|
181 |
|
|
├common - Linker script, crt0.S start-up code and central makefile
|
182 |
63 |
zero_gravi |
├example - Various example programs
|
183 |
60 |
zero_gravi |
│└...
|
184 |
69 |
zero_gravi |
├lib - Processor core library
|
185 |
|
|
│├include - Header files (*.h)
|
186 |
|
|
│└source - Source files (*.c)
|
187 |
|
|
├image_gen - Helper program to generate NEORV32 executables
|
188 |
62 |
zero_gravi |
├isa-test
|
189 |
63 |
zero_gravi |
│├riscv-arch-test - RISC-V spec. compatibility test framework (submodule)
|
190 |
|
|
│└port-neorv32 - Port files for the official RISC-V architecture tests
|
191 |
66 |
zero_gravi |
├ocd_firmware - Source code for on-chip debugger's "park loop"
|
192 |
63 |
zero_gravi |
├openocd - OpenOCD on-chip debugger configuration files
|
193 |
69 |
zero_gravi |
└svd - Processor system view description file (CMSIS-SVD)
|
194 |
60 |
zero_gravi |
...................................
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
<<<
|
199 |
|
|
// ####################################################################################################################
|
200 |
|
|
:sectnums:
|
201 |
|
|
=== VHDL File Hierarchy
|
202 |
|
|
|
203 |
68 |
zero_gravi |
All necessary VHDL hardware description files are located in the project's `rtl/core` folder. The top entity
|
204 |
60 |
zero_gravi |
of the entire processor including all the required configuration generics is **`neorv32_top.vhd`**.
|
205 |
|
|
|
206 |
|
|
[IMPORTANT]
|
207 |
|
|
All core VHDL files from the list below have to be assigned to a new design library named **`neorv32`**. Additional
|
208 |
|
|
files, like alternative top entities, can be assigned to any library.
|
209 |
|
|
|
210 |
|
|
...................................
|
211 |
61 |
zero_gravi |
neorv32_top.vhd - NEORV32 Processor top entity
|
212 |
|
|
│
|
213 |
|
|
├neorv32_fifo.vhd - General purpose FIFO component
|
214 |
|
|
├neorv32_package.vhd - Processor/CPU main VHDL package file
|
215 |
|
|
│
|
216 |
|
|
├neorv32_cpu.vhd - NEORV32 CPU top entity
|
217 |
|
|
│├neorv32_cpu_alu.vhd - Arithmetic/logic unit
|
218 |
63 |
zero_gravi |
││├neorv32_cpu_cp_bitmanip.vhd - Bit-manipulation co-processor (B ext.)
|
219 |
61 |
zero_gravi |
││├neorv32_cpu_cp_fpu.vhd - Floating-point co-processor (Zfinx ext.)
|
220 |
|
|
││├neorv32_cpu_cp_muldiv.vhd - Mul/Div co-processor (M extension)
|
221 |
|
|
││└neorv32_cpu_cp_shifter.vhd - Bit-shift co-processor
|
222 |
|
|
│├neorv32_cpu_bus.vhd - Bus interface + physical memory protection
|
223 |
|
|
│├neorv32_cpu_control.vhd - CPU control, exception/IRQ system and CSRs
|
224 |
|
|
││└neorv32_cpu_decompressor.vhd - Compressed instructions decoder
|
225 |
|
|
│└neorv32_cpu_regfile.vhd - Data register file
|
226 |
|
|
│
|
227 |
|
|
├neorv32_boot_rom.vhd - Bootloader ROM
|
228 |
|
|
│└neorv32_bootloader_image.vhd - Bootloader boot ROM memory image
|
229 |
|
|
├neorv32_busswitch.vhd - Processor bus switch for CPU buses (I&D)
|
230 |
|
|
├neorv32_bus_keeper.vhd - Processor-internal bus monitor
|
231 |
|
|
├neorv32_cfs.vhd - Custom functions subsystem
|
232 |
|
|
├neorv32_debug_dm.vhd - on-chip debugger: debug module
|
233 |
|
|
├neorv32_debug_dtm.vhd - on-chip debugger: debug transfer module
|
234 |
64 |
zero_gravi |
├neorv32_dmem.entity.vhd - Processor-internal data memory (entity-only!)
|
235 |
61 |
zero_gravi |
├neorv32_gpio.vhd - General purpose input/output port unit
|
236 |
67 |
zero_gravi |
├neorv32_gptmr.vhd - General purpose 32-bit timer
|
237 |
62 |
zero_gravi |
├neorv32_icache.vhd - Processor-internal instruction cache
|
238 |
64 |
zero_gravi |
├neorv32_imem.entity.vhd - Processor-internal instruction memory (entity-only!)
|
239 |
61 |
zero_gravi |
│└neor32_application_image.vhd - IMEM application initialization image
|
240 |
|
|
├neorv32_mtime.vhd - Machine system timer
|
241 |
|
|
├neorv32_neoled.vhd - NeoPixel (TM) compatible smart LED interface
|
242 |
|
|
├neorv32_pwm.vhd - Pulse-width modulation controller
|
243 |
67 |
zero_gravi |
├neorv32_slink.vhd - Stream link controller
|
244 |
61 |
zero_gravi |
├neorv32_spi.vhd - Serial peripheral interface controller
|
245 |
|
|
├neorv32_sysinfo.vhd - System configuration information memory
|
246 |
|
|
├neorv32_trng.vhd - True random number generator
|
247 |
|
|
├neorv32_twi.vhd - Two wire serial interface controller
|
248 |
|
|
├neorv32_uart.vhd - Universal async. receiver/transmitter
|
249 |
|
|
├neorv32_wdt.vhd - Watchdog timer
|
250 |
|
|
├neorv32_wishbone.vhd - External (Wishbone) bus interface
|
251 |
67 |
zero_gravi |
├neorv32_xirq.vhd - External interrupt controller
|
252 |
64 |
zero_gravi |
│
|
253 |
68 |
zero_gravi |
├mem/neorv32_dmem.default.vhd - _Default_ data memory (architecture-only)
|
254 |
|
|
└mem/neorv32_imem.default.vhd - _Default_ instruction memory (architecture-only)
|
255 |
60 |
zero_gravi |
...................................
|
256 |
|
|
|
257 |
64 |
zero_gravi |
[NOTE]
|
258 |
|
|
The processor-internal instruction and data memories (IMEM and DMEM) are split into two design files each:
|
259 |
|
|
a plain entity definition (`neorv32_*mem.entity.vhd`) and the actual architecture definition
|
260 |
68 |
zero_gravi |
(`mem/neorv32_*mem.default.vhd`). The `*.default.vhd` architecture definitions from `rtl/core/mem` provide a _generic_ and
|
261 |
64 |
zero_gravi |
_platform independent_ memory design that (should) infers embedded memory blocks. You can replace/modify the architecture
|
262 |
|
|
source file in order to use platform-specific features (like advanced memory resources) or to improve technology mapping
|
263 |
|
|
and/or timing.
|
264 |
60 |
zero_gravi |
|
265 |
64 |
zero_gravi |
|
266 |
60 |
zero_gravi |
<<<
|
267 |
|
|
// ####################################################################################################################
|
268 |
|
|
:sectnums:
|
269 |
|
|
=== FPGA Implementation Results
|
270 |
|
|
|
271 |
62 |
zero_gravi |
This chapter shows _exemplary_ implementation results of the NEORV32 CPU and NEORV32 Processor.
|
272 |
60 |
zero_gravi |
|
273 |
|
|
:sectnums:
|
274 |
|
|
==== CPU
|
275 |
|
|
|
276 |
|
|
[cols="<2,<8"]
|
277 |
|
|
[grid="topbot"]
|
278 |
|
|
|=======================
|
279 |
62 |
zero_gravi |
| Hardware version: | `1.5.7.10`
|
280 |
60 |
zero_gravi |
| Top entity: | `rtl/core/neorv32_cpu.vhd`
|
281 |
69 |
zero_gravi |
| FPGA: | Intel Cyclone IV E `EP4CE22F17C6`
|
282 |
|
|
| Toolchain: | Quartus Prime 20.1.0
|
283 |
60 |
zero_gravi |
|=======================
|
284 |
|
|
|
285 |
|
|
[cols="<5,>1,>1,>1,>1,>1"]
|
286 |
|
|
[options="header",grid="rows"]
|
287 |
|
|
|=======================
|
288 |
66 |
zero_gravi |
| CPU | LEs | FFs | MEM bits | DSPs | _f~max~_
|
289 |
|
|
| `rv32i` | 806 | 359 | 1024 | 0 | 125 MHz
|
290 |
|
|
| `rv32i_Zicsr_Zicntr` | 1729 | 813 | 1024 | 0 | 124 MHz
|
291 |
|
|
| `rv32im_Zicsr_Zicntr` | 2269 | 1055 | 1024 | 0 | 124 MHz
|
292 |
|
|
| `rv32imc_Zicsr_Zicntr` | 2501 | 1070 | 1024 | 0 | 124 MHz
|
293 |
|
|
| `rv32imac_Zicsr_Zicntr` | 2511 | 1074 | 1024 | 0 | 124 MHz
|
294 |
|
|
| `rv32imacu_Zicsr_Zicntr` | 2521 | 1079 | 1024 | 0 | 124 MHz
|
295 |
|
|
| `rv32imacu_Zicsr_Zicntr_Zifencei` | 2522 | 1079 | 1024 | 0 | 122 MHz
|
296 |
|
|
| `rv32imacu_Zicsr_Zicntr_Zifencei_Zfinx` | 3807 | 1731 | 1024 | 7 | 116 MHz
|
297 |
|
|
| `rv32imacu_Zicsr_Zicntr_Zifencei_Zfinx_DebugMode` | 3974 | 1815 | 1024 | 7 | 116 MHz
|
298 |
60 |
zero_gravi |
|=======================
|
299 |
|
|
|
300 |
62 |
zero_gravi |
[TIP]
|
301 |
|
|
The CPU provides further options to reduce the area footprint (for example by constraining the CPU-internal
|
302 |
|
|
counter sizes) or to increase performance (for example by using a barrel-shifter; at cost of extra hardware).
|
303 |
63 |
zero_gravi |
See section <<_processor_top_entity_generics>> for more information. Also, take a look at the User Guide section
|
304 |
|
|
https://stnolting.github.io/neorv32/ug/#_application_specific_processor_configuration[Application-Specific Processor Configuration].
|
305 |
62 |
zero_gravi |
|
306 |
|
|
|
307 |
60 |
zero_gravi |
:sectnums:
|
308 |
|
|
==== Processor Modules
|
309 |
|
|
|
310 |
|
|
[cols="<2,<8"]
|
311 |
|
|
[grid="topbot"]
|
312 |
|
|
|=======================
|
313 |
62 |
zero_gravi |
| Hardware version: | `1.5.7.15`
|
314 |
60 |
zero_gravi |
| Top entity: | `rtl/core/neorv32_top.vhd`
|
315 |
69 |
zero_gravi |
| FPGA: | Intel Cyclone IV E `EP4CE22F17C6`
|
316 |
|
|
| Toolchain: | Quartus Prime 20.1.0
|
317 |
60 |
zero_gravi |
|=======================
|
318 |
|
|
|
319 |
|
|
.Hardware utilization by the processor modules (mandatory core modules in **bold**)
|
320 |
|
|
[cols="<2,<8,>1,>1,>2,>1"]
|
321 |
|
|
[options="header",grid="rows"]
|
322 |
|
|
|=======================
|
323 |
62 |
zero_gravi |
| Module | Description | LEs | FFs | MEM bits | DSPs
|
324 |
|
|
| Boot ROM | Bootloader ROM (4kB) | 2 | 1 | 32768 | 0
|
325 |
|
|
| **BUSKEEPER** | Processor-internal bus monitor | 9 | 6 | 0 | 0
|
326 |
|
|
| **BUSSWITCH** | Bus mux for CPU instr. and data interface | 63 | 8 | 0 | 0
|
327 |
61 |
zero_gravi |
| CFS | Custom functions subsystemfootnote:[Resource utilization depends on actually implemented custom functionality.] | - | - | - | -
|
328 |
62 |
zero_gravi |
| DMEM | Processor-internal data memory (8kB) | 19 | 2 | 65536 | 0
|
329 |
|
|
| DM | On-chip debugger - debug module | 493 | 240 | 0 | 0
|
330 |
|
|
| DTM | On-chip debugger - debug transfer module (JTAG) | 254 | 218 | 0 | 0
|
331 |
|
|
| GPIO | General purpose input/output ports | 134 | 161 | 0 | 0
|
332 |
|
|
| iCACHE | Instruction cache (1x4 blocks, 256 bytes per block) | 2 21| 156 | 8192 | 0
|
333 |
|
|
| IMEM | Processor-internal instruction memory (16kB) | 13 | 2 | 131072 | 0
|
334 |
|
|
| MTIME | Machine system timer | 319 | 167 | 0 | 0
|
335 |
|
|
| NEOLED | Smart LED Interface (NeoPixel/WS28128) [FIFO_depth=1] | 226 | 182 | 0 | 0
|
336 |
|
|
| SLINK | Stream link interface (2xRX, 2xTX, FIFO_depth=1) | 208 | 181 | 0 | 0
|
337 |
|
|
| PWM | Pulse_width modulation controller (4 channels) | 71 | 69 | 0 | 0
|
338 |
|
|
| SPI | Serial peripheral interface | 148 | 127 | 0 | 0
|
339 |
|
|
| **SYSINFO** | System configuration information memory | 14 | 11 | 0 | 0
|
340 |
|
|
| TRNG | True random number generator | 89 | 76 | 0 | 0
|
341 |
|
|
| TWI | Two-wire interface | 77 | 43 | 0 | 0
|
342 |
|
|
| UART0/1 | Universal asynchronous receiver/transmitter 0/1 | 183 | 132 | 0 | 0
|
343 |
|
|
| WDT | Watchdog timer | 53 | 43 | 0 | 0
|
344 |
|
|
| WISHBONE | External memory interface | 114 | 110 | 0 | 0
|
345 |
|
|
| XIRQ | External interrupt controller (32 channels) | 241 | 201 | 0 | 0
|
346 |
67 |
zero_gravi |
| GPTMR | General Purpose Timer | 153 | 107 | 0 | 0
|
347 |
60 |
zero_gravi |
|=======================
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
<<<
|
351 |
|
|
:sectnums:
|
352 |
|
|
==== Exemplary Setups
|
353 |
|
|
|
354 |
61 |
zero_gravi |
Check out the `setups` folder (@GitHub: https://github.com/stnolting/neorv32/tree/master/setups),
|
355 |
|
|
which provides several demo setups for various FPGA boards and toolchains.
|
356 |
60 |
zero_gravi |
|
357 |
|
|
|
358 |
|
|
<<<
|
359 |
|
|
// ####################################################################################################################
|
360 |
|
|
:sectnums:
|
361 |
|
|
=== CPU Performance
|
362 |
|
|
|
363 |
62 |
zero_gravi |
The performance of the NEORV32 was tested and evaluated using the https://www.eembc.org/coremark/[Core Mark CPU benchmark].
|
364 |
|
|
This benchmark focuses on testing the capabilities of the CPU core itself rather than the performance of the whole
|
365 |
|
|
system. The according sources can be found in the `sw/example/coremark` folder.
|
366 |
60 |
zero_gravi |
|
367 |
63 |
zero_gravi |
.Dhrystone
|
368 |
|
|
[TIP]
|
369 |
|
|
A _simple_ port of the Dhrystone benchmark is also available in `sw/example/dhrystone`.
|
370 |
|
|
|
371 |
60 |
zero_gravi |
The resulting CoreMark score is defined as CoreMark iterations per second.
|
372 |
|
|
The execution time is determined via the RISC-V `[m]cycle[h]` CSRs. The relative CoreMark score is
|
373 |
|
|
defined as CoreMark score divided by the CPU's clock frequency in MHz.
|
374 |
|
|
|
375 |
62 |
zero_gravi |
.Configuration
|
376 |
60 |
zero_gravi |
[cols="<2,<8"]
|
377 |
|
|
[grid="topbot"]
|
378 |
|
|
|=======================
|
379 |
62 |
zero_gravi |
| HW version: | `1.5.7.10`
|
380 |
|
|
| Hardware: | 32kB int. IMEM, 16kB int. DMEM, no caches, 100MHz clock
|
381 |
|
|
| CoreMark: | 2000 iterations, MEM_METHOD is MEM_STACK
|
382 |
|
|
| Compiler: | RISCV32-GCC 10.2.0
|
383 |
|
|
| Compiler flags: | default, see makefile
|
384 |
60 |
zero_gravi |
|=======================
|
385 |
|
|
|
386 |
|
|
.CoreMark results
|
387 |
62 |
zero_gravi |
[cols="<4,^1,^1,^1"]
|
388 |
60 |
zero_gravi |
[options="header",grid="rows"]
|
389 |
|
|
|=======================
|
390 |
66 |
zero_gravi |
| CPU | CoreMark Score | CoreMarks/MHz | Average CPI
|
391 |
|
|
| _small_ (`rv32i_Zicsr`) | 33.89 | **0.3389** | **4.04**
|
392 |
|
|
| _medium_ (`rv32imc_Zicsr`) | 62.50 | **0.6250** | **5.34**
|
393 |
|
|
| _performance_ (`rv32imc_Zicsr` + perf. options) | 95.23 | **0.9523** | **3.54**
|
394 |
60 |
zero_gravi |
|=======================
|
395 |
|
|
|
396 |
|
|
[NOTE]
|
397 |
62 |
zero_gravi |
The "_performance_" CPU configuration uses the <<_fast_mul_en>> and <<_fast_shift_en>> options.
|
398 |
60 |
zero_gravi |
|
399 |
62 |
zero_gravi |
[NOTE]
|
400 |
60 |
zero_gravi |
The NEORV32 CPU is based on a multi-cycle architecture. Each instruction is executed in a sequence of
|
401 |
62 |
zero_gravi |
several consecutive micro operations.
|
402 |
60 |
zero_gravi |
|
403 |
62 |
zero_gravi |
[NOTE]
|
404 |
60 |
zero_gravi |
The average CPI (cycles per instruction) depends on the instruction mix of a specific applications and also on
|
405 |
62 |
zero_gravi |
the available CPU extensions. The average CPI is computed by dividing the total number of required clock cycles
|
406 |
|
|
(only the timed core to avoid distortion due to IO wait cycles) by the number of executed instructions
|
407 |
|
|
(`[m]instret[h]` CSRs).
|
408 |
60 |
zero_gravi |
|
409 |
|
|
[TIP]
|
410 |
|
|
More information regarding the execution time of each implemented instruction can be found in
|
411 |
|
|
chapter <<_instruction_timing>>.
|