Line 2... |
Line 2... |
|
|
[![Build Status](https://travis-ci.com/stnolting/neorv32.svg?branch=master)](https://travis-ci.com/stnolting/neorv32)
|
[![Build Status](https://travis-ci.com/stnolting/neorv32.svg?branch=master)](https://travis-ci.com/stnolting/neorv32)
|
[![license](https://img.shields.io/github/license/stnolting/neorv32)](https://github.com/stnolting/neorv32/blob/master/LICENSE)
|
[![license](https://img.shields.io/github/license/stnolting/neorv32)](https://github.com/stnolting/neorv32/blob/master/LICENSE)
|
[![release](https://img.shields.io/github/v/release/stnolting/neorv32)](https://github.com/stnolting/neorv32/releases)
|
[![release](https://img.shields.io/github/v/release/stnolting/neorv32)](https://github.com/stnolting/neorv32/releases)
|
|
|
[![issues](https://img.shields.io/github/issues/stnolting/neorv32)](https://github.com/stnolting/neorv32/issues)
|
|
[![pull requests](https://img.shields.io/github/issues-pr/stnolting/neorv32)](https://github.com/stnolting/neorv32/pulls)
|
|
[![last commit](https://img.shields.io/github/last-commit/stnolting/neorv32)](https://github.com/stnolting/neorv32/commits/master)
|
|
|
|
|
|
|
|
## Table of Content
|
## Table of Content
|
|
|
* [Introduction](#Introduction)
|
* [Introduction](#Introduction)
|
* [Features](#Features)
|
* [Features](#Features)
|
* [FPGA Implementation Results](#FPGA-Implementation-Results)
|
* [FPGA Implementation Results](#FPGA-Implementation-Results)
|
* [Performance](#Performance)
|
* [Performance](#Performance)
|
* [Top Entity](#Top-Entity)
|
* [Top Entity](#Top-Entity)
|
* [**Getting Started**](#Getting-Started)
|
* [**Getting Started**](#Getting-Started)
|
* [Contact](#Contact)
|
* [Contribute](#Contribute)
|
* [Legal](#Legal)
|
* [Legal](#Legal)
|
|
|
|
|
|
|
## Introduction
|
## Introduction
|
Line 30... |
Line 25... |
ISA Specification Version 2.1** and a subset of the **Privileged Architecture Specification Version 1.12**. The NEORV32 is intended
|
ISA Specification Version 2.1** and a subset of the **Privileged Architecture Specification Version 1.12**. The NEORV32 is intended
|
as auxiliary processor within a larger SoC designs or as stand-alone custom microcontroller.
|
as auxiliary processor within a larger SoC designs or as stand-alone custom microcontroller.
|
|
|
The processor provides common peripherals and interfaces like input and output ports, serial interfaces for UART, I²C and SPI,
|
The processor provides common peripherals and interfaces like input and output ports, serial interfaces for UART, I²C and SPI,
|
interrupt controller, timers and embedded memories. External memories, peripherals and custom IP can be attached via a
|
interrupt controller, timers and embedded memories. External memories, peripherals and custom IP can be attached via a
|
Wishbone-based external memory interface. All optional features beyond the base CPU can be enabled configured via VHDL generics.
|
Wishbone-based external memory interface. All optional features beyond the base CPU can be enabled and configured via VHDL generics.
|
|
|
This project comes with a complete software ecosystem that features core libraries for high-level usage of the
|
This project comes with a complete software ecosystem that features core libraries for high-level usage of the
|
provided functions and peripherals, application makefiles and example programs. All software source files
|
provided functions and peripherals, application makefiles and example programs. All software source files
|
provide a doxygen-based documentary.
|
provide a doxygen-based documentary.
|
|
|
Line 59... |
Line 54... |
The processor is synthesizable (tested with Intel Quartus Prime, Xilinx Vivado and Lattice Radiant/LSE) and can successfully execute
|
The processor is synthesizable (tested with Intel Quartus Prime, Xilinx Vivado and Lattice Radiant/LSE) and can successfully execute
|
all the [provided example programs](https://github.com/stnolting/neorv32/tree/master/sw/example) including the CoreMark benchmark.
|
all the [provided example programs](https://github.com/stnolting/neorv32/tree/master/sw/example) including the CoreMark benchmark.
|
|
|
The processor passes the official `rv32i`, `rv32im`, `rv32imc`, `rv32Zicsr` and `rv32Zifencei` [RISC-V compliance tests](https://github.com/riscv/riscv-compliance).
|
The processor passes the official `rv32i`, `rv32im`, `rv32imc`, `rv32Zicsr` and `rv32Zifencei` [RISC-V compliance tests](https://github.com/riscv/riscv-compliance).
|
|
|
| | |
|
| Project | Status |
|
|:--------------------------------------------------------------------------------|:-------|
|
|:--------------------------------------------------------------------------------|:-------|
|
|
| NEORV32 processor | [![Build Status](https://travis-ci.com/stnolting/neorv32.svg?branch=master)](https://travis-ci.com/stnolting/neorv32) |
|
| [Pre-build toolchain](https://github.com/stnolting/riscv_gcc_prebuilt) | [![Build Test](https://travis-ci.com/stnolting/riscv_gcc_prebuilt.svg?branch=master)](https://travis-ci.com/stnolting/riscv_gcc_prebuilt) |
|
| [Pre-build toolchain](https://github.com/stnolting/riscv_gcc_prebuilt) | [![Build Test](https://travis-ci.com/stnolting/riscv_gcc_prebuilt.svg?branch=master)](https://travis-ci.com/stnolting/riscv_gcc_prebuilt) |
|
| [RISC-V compliance test](https://github.com/stnolting/neorv32_compliance_test) | [![Build Status](https://travis-ci.com/stnolting/neorv32_riscv_compliance.svg?branch=master)](https://travis-ci.com/stnolting/neorv32_riscv_compliance) |
|
| [RISC-V compliance test](https://github.com/stnolting/neorv32_compliance_test) | [![Build Status](https://travis-ci.com/stnolting/neorv32_riscv_compliance.svg?branch=master)](https://travis-ci.com/stnolting/neorv32_riscv_compliance) |
|
|
|
|
|
#### Limitations to be fixed
|
### Limitations to be fixed
|
|
|
* No exception is triggered in `E`-mode when using registers above `x15` yet
|
* No exception is triggered in `E`-mode when using registers above `x15` yet
|
|
|
|
|
#### To-Do / Wish List
|
### To-Do / Wish List
|
|
|
|
- Synthesis results for more platforms
|
- Port Dhrystone benchmark
|
- Port Dhrystone benchmark
|
- Implement atomic operations (`A` extension)
|
- Implement atomic operations (`A` extension)
|
- Implement `Zifence` extension
|
|
- Implement co-processor for single-precision floating-point operations (`F` extension)
|
- Implement co-processor for single-precision floating-point operations (`F` extension)
|
- Implement user mode (`U` extension)
|
- Implement user mode (`U` extension)
|
- Make a 64-bit branch
|
- Make a 64-bit branch
|
- Maybe port an RTOS (like [freeRTOS](https://www.freertos.org/) or [RIOT](https://www.riot-os.org/))
|
- Maybe port an RTOS (like [freeRTOS](https://www.freertos.org/) or [RIOT](https://www.riot-os.org/))
|
|
|
Line 153... |
Line 149... |
* Load address misaligned
|
* Load address misaligned
|
* Load access fault
|
* Load access fault
|
* Store address misaligned
|
* Store address misaligned
|
* Store access fault
|
* Store access fault
|
* Environment call from M-mode (via `ecall` instruction)
|
* Environment call from M-mode (via `ecall` instruction)
|
* Machine software instrrupt
|
* Machine software instrrupt `msi`
|
* Machine timer interrupt (via `MTIME` unit)
|
* Machine timer interrupt `mti` (via MTIME unit)
|
* Machine external interrupt (via `CLIC` unit)
|
* Machine external interrupt `mei` (via CLIC unit)
|
|
|
**Privileged architecture / FENCE.I** (`Zifencei` extension):
|
**Privileged architecture / FENCE.I** (`Zifencei` extension):
|
* System instructions: `FENCE.I`
|
* System instructions: `FENCE.I`
|
|
|
**General**:
|
**General**:
|
Line 261... |
Line 257... |
| `rv32imc` | `-O2` | 15 208 bytes | 50 | 0.50 |
|
| `rv32imc` | `-O2` | 15 208 bytes | 50 | 0.50 |
|
|
|
|
|
### Instruction Cycles
|
### Instruction Cycles
|
|
|
The NEORV32 CPU is based on a multi-cycle architecture. Each instruction is executed in a sequence of several
|
The NEORV32 CPU is based on two-stages pipelined architecutre. Each stage uses a multi-cycle processing scheme. Hence,
|
consecutive micro operations. Hence, each instruction requires several clock cycles to execute. The average CPI
|
each instruction requires several clock cycles to execute (2 cycles for ALU operations, ..., 40 cycles for divisions).
|
(cycles per instruction) depends on the instruction mix of a specific applications and also on the available
|
The average CPI (cycles per instruction) depends on the instruction mix of a specific applications and also on the available
|
CPU extensions.
|
CPU extensions.
|
|
|
Please note that the CPU-internal shifter (e.g. for the `SLL` instruction) as well as the multiplier and divider of the
|
Please note that the CPU-internal shifter (e.g. for the `SLL` instruction) as well as the multiplier and divider of the
|
`M` extension use a bit-serial approach and require several cycles for completion.
|
`M` extension use a bit-serial approach and require several cycles for completion.
|
|
|
The following table shows the performance results for successfully running 2000 CoreMark
|
The following table shows the performance results for successfully running 2000 CoreMark
|
iterations. The average CPI is computed by dividing the total number of required clock cycles (all of CoreMark
|
iterations, which reflects a pretty good "real-life" work load. The average CPI is computed by
|
|
dividing the total number of required clock cycles (all of CoreMark
|
– not only the timed core) by the number of executed instructions (`instret[h]` CSRs). The executables
|
– not only the timed core) by the number of executed instructions (`instret[h]` CSRs). The executables
|
were generated using optimization `-O2`.
|
were generated using optimization `-O2`.
|
|
|
| CPU / Toolchain Config. | Required Clock Cycles | Executed Instructions | Average CPI |
|
| CPU / Toolchain Config. | Required Clock Cycles | Executed Instructions | Average CPI |
|
|:------------------------|----------------------:|----------------------:|:-----------:|
|
|:------------------------|----------------------:|----------------------:|:-----------:|
|
Line 411... |
Line 408... |
has been compiled on a 64-bit x86 Ubuntu (Ubuntu on Windows). Download the toolchain of choice:
|
has been compiled on a 64-bit x86 Ubuntu (Ubuntu on Windows). Download the toolchain of choice:
|
|
|
[https://github.com/stnolting/riscv_gcc_prebuilt](https://github.com/stnolting/riscv_gcc_prebuilt)
|
[https://github.com/stnolting/riscv_gcc_prebuilt](https://github.com/stnolting/riscv_gcc_prebuilt)
|
|
|
|
|
### Dowload the Project and Create a Hardware Project
|
### Dowload the NEORV32 Project and Create a Hardware Project
|
|
|
Now its time to get the most recent version the NEORV32 Processor project from GitHub. Clone the NEORV32 repository using
|
Now its time to get the most recent version the NEORV32 Processor project from GitHub. Clone the NEORV32 repository using
|
`git` from the command line (suggested for easy project updates via `git pull`):
|
`git` from the command line (suggested for easy project updates via `git pull`):
|
|
|
$ git clone https://github.com/stnolting/neorv32.git
|
$ git clone https://github.com/stnolting/neorv32.git
|
Line 451... |
Line 448... |
Make sure `GNU Make` and a native `GCC` compiler are installed. To test the installation of the RISC-V toolchain, navigate to an example project like
|
Make sure `GNU Make` and a native `GCC` compiler are installed. To test the installation of the RISC-V toolchain, navigate to an example project like
|
`sw/example/blink_led` and run:
|
`sw/example/blink_led` and run:
|
|
|
neorv32/sw/example/blink_led$ make check
|
neorv32/sw/example/blink_led$ make check
|
|
|
The NEORV32 project includes some example programs from which you can start your own application:
|
The NEORV32 project includes some [example programs](https://github.com/stnolting/neorv32/tree/master/sw/example) from
|
[SW example projects](https://github.com/stnolting/neorv32/tree/master/sw/example)
|
which you can start your own application. Simply compile one of these projects. This will create a NEORV32
|
|
executable `neorv32_exe.bin` in the same folder.
|
Simply compile one of these projects. This will create a NEORV32 executable `neorv32_exe.bin` in the same folder.
|
|
|
|
neorv32/sw/example/blink_led$ make clean_all compile
|
neorv32/sw/example/blink_led$ make clean_all compile
|
|
|
Connect your FPGA board via UART to you computer and open the according port to interface with the NEORV32 bootloader. The bootloader
|
Connect your FPGA board via UART to you computer and open the according port to interface with the NEORV32 bootloader. The bootloader
|
uses the following default UART configuration:
|
uses the following default UART configuration:
|
Line 468... |
Line 464... |
- 1 stop bit
|
- 1 stop bit
|
- No parity bits
|
- No parity bits
|
- No transmission / flow control protocol (raw bytes only)
|
- No transmission / flow control protocol (raw bytes only)
|
- Newline on `\r\n` (carriage return & newline)
|
- Newline on `\r\n` (carriage return & newline)
|
|
|
Use the bootloader console to upload and execute your application image.
|
Use the bootloader console to upload the `neorv32_exe.bin` file and run your application image.
|
|
|
Going further: Take a look at the [![NEORV32 datasheet](https://raw.githubusercontent.com/stnolting/neorv32/master/docs/figures/PDF_32.png) NEORV32 datasheet](https://raw.githubusercontent.com/stnolting/neorv32/master/docs/NEORV32.pdf).
|
```
|
|
<< NEORV32 Bootloader >>
|
|
|
|
BLDV: Jul 6 2020
|
|
HWV: 1.0.1.0
|
|
CLK: 0x0134FD90 Hz
|
|
MHID: 0x0001CE40
|
|
MISA: 0x42801104
|
|
CONF: 0x03FF0035
|
|
IMEM: 0x00010000 bytes @ 0x00000000
|
|
DMEM: 0x00010000 bytes @ 0x80000000
|
|
|
|
Autoboot in 8s. Press key to abort.
|
|
Aborted.
|
|
|
|
Available CMDs:
|
|
h: Help
|
|
r: Restart
|
|
u: Upload
|
|
s: Store to flash
|
|
l: Load from flash
|
|
e: Execute
|
|
CMD:> u
|
|
Awaiting neorv32_exe.bin... OK
|
|
CMD:> e
|
|
Booting...
|
|
|
|
Blinking LED demo program
|
|
```
|
|
|
|
Going further: Take a look at the _Let's Get It Started!_ chapter of the [![NEORV32 datasheet](https://raw.githubusercontent.com/stnolting/neorv32/master/docs/figures/PDF_32.png) NEORV32 datasheet](https://raw.githubusercontent.com/stnolting/neorv32/master/docs/NEORV32.pdf).
|
|
|
|
|
## Contact
|
|
|
|
If you have any questions, bug reports, ideas or if you are facing problems with the NEORV32 or want to give some kind of feedback, open a
|
## Contribute
|
[new issue](https://github.com/stnolting/neorv32/issues) or directly drop me a line:
|
|
|
|
stnolting@gmail.com
|
I'm always thankful for help! So if you have any questions, bug reports, ideas or if you want to give some kind of feedback, feel free
|
|
to open a [new issue](https://github.com/stnolting/neorv32/issues).
|
|
|
|
If you want to get involved you can also directly drop me a line (mailto:stnolting@gmail.com).
|
|
Please also check out the project's [code of conduct](https://github.com/stnolting/neorv32/tree/master/CODE_OF_CONDUCT.md).
|
|
|
|
|
|
|
## Citation
|
## Citation
|
|
|
Line 496... |
Line 523... |
## Legal
|
## Legal
|
|
|
This is a hobby project released under the BSD 3-Clause license. No copyright infringement intended.
|
This is a hobby project released under the BSD 3-Clause license. No copyright infringement intended.
|
Other implied/used projects might have different licensing - see their documentation to get more information.
|
Other implied/used projects might have different licensing - see their documentation to get more information.
|
|
|
**BSD 3-Clause License**
|
#### BSD 3-Clause License
|
|
|
Copyright (c) 2020, Stephan Nolting. All rights reserved.
|
Copyright (c) 2020, Stephan Nolting. All rights reserved.
|
|
|
Redistribution and use in source and binary forms, with or without modification, are
|
Redistribution and use in source and binary forms, with or without modification, are
|
permitted provided that the following conditions are met:
|
permitted provided that the following conditions are met:
|
Line 523... |
Line 550... |
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
#### Limitation of Liability for External Links
|
|
|
|
Our website contains links to the websites of third parties („external links“). As the
|
|
content of these websites is not under our control, we cannot assume any liability for
|
|
such external content. In all cases, the provider of information of the linked websites
|
|
is liable for the content and accuracy of the information provided. At the point in time
|
|
when the links were placed, no infringements of the law were recognisable to us. As soon
|
|
as an infringement of the law becomes known to us, we will immediately remove the
|
|
link in question.
|
|
|
|
|
|
#### Propretary Notice
|
|
|
"Windows" is a trademark of Microsoft Corporation.
|
"Windows" is a trademark of Microsoft Corporation.
|
|
|
"Artix" and "Vivado" are trademarks of Xilinx Inc.
|
"Artix" and "Vivado" are trademarks of Xilinx Inc.
|
|
|
"Cyclone", "Quartus Prime" and "Avalon Bus" are trademarks of Intel Corporation.
|
"Cyclone", "Quartus Prime" and "Avalon Bus" are trademarks of Intel Corporation.
|
Line 534... |
Line 574... |
"iCE40", "UltraPlus" and "Lattice Radiant" are trademarks of Lattice Semiconductor Corporation.
|
"iCE40", "UltraPlus" and "Lattice Radiant" are trademarks of Lattice Semiconductor Corporation.
|
|
|
"AXI4" and "AXI4-Lite" are trademarks of Arm Holdings plc.
|
"AXI4" and "AXI4-Lite" are trademarks of Arm Holdings plc.
|
|
|
|
|
|
#### Misc
|
|
|
[![Continous Integration provided by Travis CI](https://travis-ci.com/images/logos/TravisCI-Full-Color.png)](https://travis-ci.com/stnolting/neorv32)
|
[![Continous Integration provided by Travis CI](https://travis-ci.com/images/logos/TravisCI-Full-Color.png)](https://travis-ci.com/stnolting/neorv32)
|
|
|
Continous integration provided by [Travis CI](https://travis-ci.com/stnolting/neorv32) and powered by [GHDL](https://github.com/ghdl/ghdl).
|
Continous integration provided by [Travis CI](https://travis-ci.com/stnolting/neorv32) and powered by [GHDL](https://github.com/ghdl/ghdl).
|
|
|
|
|