Biscuit: RISC-V Runtime Code Generation Library
RISC it for the biscuit
About
An experimental runtime code generator for RISC-V.
This allows for runtime code generation of RISC-V instructions. Similar to how Xbyak allows for runtime code generation of x86 instructions.
Implemented ISA Features
Includes both 32-bit and 64-bit instructions in the following:
Feature | Version |
---|---|
A | 2.1 |
B | 1.0 |
C | 2.0 |
D | 2.2 |
F | 2.2 |
H | 1.0 RC |
K | 1.0.1 |
M | 2.0 |
N | 1.1 |
Q | 2.2 |
RV32I | 2.1 |
RV64I | 2.1 |
S | 1.12 |
V | 1.0 |
Sstc | 0.5.4 |
Zfh | 1.0 |
Zfhmin | 1.0 |
Zicbom | 1.0 |
Zicbop | 1.0 |
Zicboz | 1.0 |
Zicsr | 2.0 |
Zifencei | 2.0 |
Zihintntl | 0.2 |
Note that usually only extensions considered ratified will be implemented as non-ratified documents are considerably more likely to have large changes made to them, which makes maintaining instruction APIs a little annoying.
Dependencies
Biscuit requires no external dependencies for its library other than the C++ standard library. The tests, however, use the Catch2 testing library. This is included in tree so there's no need to worry about installing it yourself if you wish to run said tests.
Building Biscuit
Generate the build files for the project with CMake
Hit the build button in your IDE of choice, or run the relevant console command to build for the CMake generator you've chosen.
Done.
Running Tests
Generate the build files for the project with CMake
Build the tests
Run the test executable directly, or enter
ctest
into your terminal.
License
The library is licensed under the MIT license.
While it's not a requirement whatsoever, it'd be pretty neat if you told me that you found the library useful 😃
Example
The following is an adapted equivalent of the strlen
implementation within the RISC-V bit manipulation extension specification. For brevity, it has been condensed to only handle little-endian platforms.