RISC-V is an open and free standard or RISC ISA. It exists in 32,64 and still in draft stage, 128 bits wide versions. There are lot of free or non free implementations. You can find software, FPGA, or ASIC implementations on most codeforges like Github, Gitlab, Gitea, etc... Several research institute around the world also opened their own versions.
The RISC-V processor ISA
The RISC-V Processor is a RISC based architecture, with less instructions than most other RISC processors, as one the goal is to hardly shrink number of transistors. For example, there is no GT (>) or LE (<=) hardware instructions, only LT (<) or GE (>=) instructions, but GT and LE can be synthesized by switching it to LT/GE, and the registers in test to keep the test as needed. The only immediate value possible is coded on 12 bits. If the value is signed, the sign will be extended to the higher bit, of the size of the register. Several instructions are supported in RISC-V assembly language that doesn't actually exists as code machine instructions.
Generally less instruction in ISA (Instruction Set Architecture) as for RISC-V, means more instruction in machine code to have the same computation process, so RISC-V is not really competitive with other architectures for size-coding. It's advantage is more on transistors size-coding in its implementations, allowing more cores or more extensions than other architecture for the same die size, and a more efficient computation/power ratio.
One of the main goals of the specifications is to have modularity with high granularity. So bitwise operators, multiplications/divisions, vector instructions for example are on different optional extensions, that can be implemented or not by RISC-V processor makers, reducing the total number of transistors depending on processor usage. Each extension have its own letter added in the name of the processor.
The specifications are all available on the risc-v.org site: https://riscv.org/technical/specifications/
Nomenclature and extensions
- RV|32/64/128|E/I/G: RiscV, 32, 64 or 128 bits, base Embedded/ Integer/General purpose instruction set
So you will see generally RV32I for 32bits version + other letters corresponding to extensions as defined below. RV32E means (still) reduced, embedded systems version of integer instruction set. RV32I or (RV64G) means RV32 or RV64 + General purpose (including IMAFD + Zicsr+ Zifenci extension) as described below:
Basic 'standardized extension are:
- Zifencei: Instruction-Fetch Fence
- M: Multiplication/division
- A: Atomic instructions
- Zicsr: Control and Status Register
- F: Single-precision Floating-Point
- D: Double-precision Floating-Point
- G: General pupose (all of the above together)
- Q: Quad-precision Floating-Point
- L: Decimal Floating-Point (IEEE 754-2008)
- C: Compressed instructions
- B: Bit manipulation
- J: JIT for dynamically translated languages
- T: Transactional memory
- P: Packed SIMD instructions
- V: Vector instructions (as a vector processor, not as a packed SIMD)
- Zam: Misaligned Atomics
- Ztso: Total Store Ordering
- S: Supervisor-level Instruction-Set Extensions
- H: Hypervisor-level Instruction-Set Extensions
- X<name>: Non standard extension
- Crypto extension is frozen, and should be available in October.
Registers in assembly language can be called x0-x31 or by their specific functions. x0 is always 0 and can't be changed.
- GNU tools contains both RISC-V 32 and 64bits compiler (GCC), assembler (gnu-binutils) and debugger (GDB), they are available for native or cross-compiling on most GNU/Linux distribution.
- Bronzebeard is a standalone assembler for developing bare metal RISC-V programs. It has been used mainly on Longan Nano a RV32 board generally sold with an LCD screen. There are few demo on this board. The initialisation of the screen on this platform has an important footprint that can't allow to go in 128B or 256B competitions.
- Arduino has several RISC-V implementations.
Most other languages are also available in RISC-V instruction set. Some Linux distribution have been ported and ISO are available (Debian, Ubuntu for example). Haiku OS also work on RISC-V platform, and there are plenty of embedded OS working on it (Arduino, FreeRTOS, HarmonyOS, LiteOS, RT-Thread, RustOS, Zephyr...).
If you don't have one of those cheap boards, you can still test RISC-V assembly on an emulator. Qemu allow to execute RISC-V application or systems on any kind of architectures. You can use the same tricks than used on x86 to reduce the binary size of the ELF binary format made with GNU tools.
The main author of Qemu also made TinyEmu, a RISC−V only tiny emulator, it already has WASM ports, so you can play with it on the web.