2015-06-06 08:01:37 -04:00
|
|
|
|
|
|
|
PicoRV32 - A Size-Optimized RISC-V CPU
|
|
|
|
======================================
|
|
|
|
|
|
|
|
PicoRV32 is a CPU core that implements the [RISC-V RV32I Instruction Set](http://riscv.org/).
|
|
|
|
|
|
|
|
Tools (gcc, binutils, etc..) can be obtained via the [RISC-V Website](http://riscv.org/download.html#tab_tools).
|
|
|
|
|
2015-06-06 11:24:11 -04:00
|
|
|
PicoRV32 is free and open hardware licensed under the [ISC license](http://en.wikipedia.org/wiki/ISC_license)
|
|
|
|
(a license that is similar in terms to the MIT license or the 2-clause BSD license).
|
|
|
|
|
2015-06-06 08:01:37 -04:00
|
|
|
|
|
|
|
Features and Typical Applications:
|
|
|
|
----------------------------------
|
|
|
|
|
2015-06-06 15:27:58 -04:00
|
|
|
- Small (~1000 LUTs in a 7-Series Xilinx FGPA)
|
2015-06-06 08:01:37 -04:00
|
|
|
- High fMAX (>250 MHz on 7-Series Xilinx FGPAs)
|
|
|
|
- Selectable native memory interface or AXI4-Lite master
|
|
|
|
|
|
|
|
This CPU is meant to be used as auxiliary processor in FPGA designs and ASICs. Due
|
|
|
|
to its high fMAX it can be integrated in most existing designs without crossing
|
|
|
|
clock domains. When operated on a lower frequency, it will have a lot of timing
|
|
|
|
slack and thus can be added to a design without compromising timing closure.
|
|
|
|
|
|
|
|
For even smaller size it is possible disable support for registers `x16`..`x31` as
|
|
|
|
well as `RDCYCLE[H]`, `RDTIME[H]`, and `RDINSTRET[H]` instructions, turning the
|
|
|
|
processor into an RV32E core.
|
|
|
|
|
2015-06-07 14:59:20 -04:00
|
|
|
Furthermore it is possible to choose between a single-port and a dual-port
|
|
|
|
register file implementation. The former provides better performance while
|
|
|
|
the latter results in a smaller core.
|
|
|
|
|
2015-06-06 08:01:37 -04:00
|
|
|
*Note: In architectures that implement the register file in dedicated memory
|
2015-06-07 14:59:20 -04:00
|
|
|
resources, such as many FPGAs, disabling the 16 upper registers and/or
|
|
|
|
disabling the dual-port register file may not further reduce the core size.*
|
2015-06-06 08:01:37 -04:00
|
|
|
|
|
|
|
The core exists in two variations: `picorv32` and `picorv32_axi`. The former
|
|
|
|
provides a simple native memory interface, that is easy to use in simple
|
|
|
|
environments, and the latter provides an AXI-4 Lite Master interface that can
|
|
|
|
easily be integrated with existing systems that are already using the AXI
|
|
|
|
standard.
|
|
|
|
|
|
|
|
A separate core `picorv32_axi_adapter` is provided to bridge between the native
|
|
|
|
memory interface and AXI4. This core can be used to create custom cores that
|
|
|
|
include one or more PicoRV32 cores together with local RAM, ROM, and
|
|
|
|
memory-mapped peripherals, communicating with each other using the native
|
|
|
|
interface, and communicating with the outside world via AXI4.
|
|
|
|
|
|
|
|
|
2015-06-07 14:53:19 -04:00
|
|
|
Parameters:
|
|
|
|
-----------
|
|
|
|
|
|
|
|
The following Verilog module parameters can be used to configure the PicoRV32
|
|
|
|
core.
|
|
|
|
|
|
|
|
### ENABLE_COUNTERS (default = 1)
|
|
|
|
|
|
|
|
This parameter enables support for the `RDCYCLE[H]`, `RDTIME[H]`, and
|
|
|
|
`RDINSTRET[H]` instructions. This instructions will cause a hardware
|
|
|
|
trap (like any other unsupported instruction) if `ENABLE_COUNTERS` is set to zero.
|
|
|
|
|
|
|
|
*Note: Strictly speaking the `RDCYCLE[H]`, `RDTIME[H]`, and `RDINSTRET[H]`
|
|
|
|
instructions are not optional for an RV32I core. But chances are they are not
|
|
|
|
going to be missed after the application code has been debugged and profiled.
|
|
|
|
This instructions are optional for an RV32E core.*
|
|
|
|
|
|
|
|
### ENABLE_REGS_16_31 (default = 1)
|
|
|
|
|
|
|
|
This parameter enables support for registers the `x16`..`x31`. The RV32E ISA
|
|
|
|
excludes this registers. However, the RV32E ISA spec requires a hardware trap
|
|
|
|
for when code tries to access this registers. This is not implemented in PicoRV32.
|
|
|
|
|
|
|
|
### ENABLE_REGS_DUALPORT (default = 1)
|
|
|
|
|
|
|
|
The register file can be implemented with two or one read ports. A dual ported
|
|
|
|
register file improves performance a bit, but can also increase the size of
|
|
|
|
the core.
|
|
|
|
|
|
|
|
|
2015-06-06 08:01:37 -04:00
|
|
|
Performance:
|
|
|
|
------------
|
|
|
|
|
2015-06-07 14:53:19 -04:00
|
|
|
*A short reminder: This core is optimized for size, not performance.*
|
|
|
|
|
|
|
|
Unless stated otherwise, the following numbers apply to a PicoRV32 with
|
|
|
|
ENABLE_REGS_DUALPORT active and connected to a memory that can accomodate
|
|
|
|
requests within one clock cycle.
|
2015-06-07 02:28:10 -04:00
|
|
|
|
2015-06-07 14:53:19 -04:00
|
|
|
The average Cycles per Instruction (CPI) is 4 to 5, depending on the mix of
|
|
|
|
instructions in the code. The CPI numbers for the individual instructions
|
|
|
|
can be found in the following table. (The column "CPI (SP)" contains the
|
|
|
|
CPI numbers for a core built without ENABLE_REGS_DUALPORT.)
|
2015-06-07 02:28:10 -04:00
|
|
|
|
2015-06-07 14:53:19 -04:00
|
|
|
| Instruction | CPI | CPI (SP) |
|
|
|
|
| ---------------------| ----:| --------:|
|
|
|
|
| direct jump (jal) | 3 | 3 |
|
|
|
|
| ALU reg + immediate | 3 | 3 |
|
|
|
|
| ALU reg + reg | 3 | 4 |
|
|
|
|
| branch (not taken) | 3 | 4 |
|
|
|
|
| memory load | 5 | 5 |
|
|
|
|
| memory store | 5 | 6 |
|
|
|
|
| branch (taken) | 5 | 6 |
|
|
|
|
| indirect jump (jalr) | 6 | 6 |
|
|
|
|
| shift operations | 4-14 | 4-15 |
|
2015-06-07 02:28:10 -04:00
|
|
|
|
2015-06-07 14:53:19 -04:00
|
|
|
Dhrystone benchmark results: 0.309 DMIPS/MHz (544 Dhrystones/Second/MHz)
|
2015-06-07 02:28:10 -04:00
|
|
|
|
2015-06-07 14:53:19 -04:00
|
|
|
For the Dryhstone benchmark the average CPI is 4.167.
|
2015-06-06 08:01:37 -04:00
|
|
|
|
|
|
|
|
|
|
|
Todos:
|
|
|
|
------
|
|
|
|
|
|
|
|
- Optional IRQ support
|
|
|
|
- Optional write-through cache
|
|
|
|
- Optional support for compressed ISA
|
|
|
|
|