2019-2023 by Anton Mause
Design target : Build small 16 bit CPU based on RISC-V RV32I ISA using on chip hardware resources.
This family of CPUs should act like a RV32I for all values that fit into +/-32k.
Resource oriented design, wrapped around one Multiply-Adder-Subtractor-Unit MACC. RV16gpo starts as small as 172 LUT4 with simple blinky running (PLEN=XLEN=6,CLK=OSC).
See signal flow in diagram attached.
The MACC provides P=C+/-B*A as a hard macro and some of these are spread all over the FPGA.
Thought it could be clever to use this resource instead of generating a ALU from logic gates.
This rv16poc routes the data and configures the MACC to make use of it.
The rv16 concept maps best on G4, G5 needs different register memory layout, so it is a bit less efficient.
The current snapshot is intended to use Libero SoC version 2024.1
Unpack ./rv16poc-RevXYZ.zip to your projects directory and name ./rv16poc/ .
Edit ./scripts/g..config.tcl if you use older Libero, or even checkout older repo. Adjust your installation path of Libero and SoftConsole C: vs D: and so
run : Libero -> Project -> Execute Script -> xyz_create.tcl
Beside the well known CISC and RISC processor class, there is one named MISC, for "minimalistic instruction set computer". By definition these can have up to 32 instructions, the bare rv16 supports up to 33 instructions. Instructions not used get optimized away by the synthesis tool. So it should be OK to put this CPU into the light weight MISC class.
No interrupt, status or control register support or at all, rv16 is intended to fill the gap between a hand coded state machine and a real CPU. The current design uses way more LUT elements than register and an extra dummy idle slot. It should be possible to drop to 2/3 cycle, investing a bit more register than now, maybe even enable pipelining.
The rv16gpo version uses a hand optimized opcode pre-decoder (Thanx to Karnaugh), so only 2 to 3 bits from the 7 bit wide opcode are used. This saves a lot LUT elements, but will never detect unexpected instructions and obviously fail silently.