libspike-interfaces is a C language API interface for the RISC-V ISA Simulator (Spike), designed to facilitate usage of Spike from other languages via Foreign Function Interface (FFI).
This project provides a set of C language functions and data structures that serve as a bridge between Spike and other programming languages. By using these interfaces, developers can seamlessly integrate Spike functionality into their projects without needing to directly interact with Spike's internals.
- FFI Compatibility: Designed for easy integration with other programming languages through Foreign Function Interface mechanisms.
- Nix Build System: Utilizes the Nix package manager for easy dependency management and reproducible builds.
- Example Applications: Includes example applications demonstrating how to use the libspike-interfaces library.
We use nix flake as our primary build system. If you have not installed nix, install it following the guide, and enable flake following the wiki. Or you can try the installer provided by Determinate Systems, which enables flake by default.
To build the library, run:
nix build .#libspike_interfaces
The resulting shared library (libspike_interfaces.so
) will be available in the result/lib
.
You can run and test the C example code as follows:
nix build .#elfloader
./result/bin/elfloader ./resources/conv-mlir.elf
Alternatively, you can just run in one line:
nix run .#elfloader ./resources/conv-mlir.elf
And you can run and test the Rust example code as follows:
nix run .#rs_elfloader -- -e ./resources/conv-mlir.elf
Contributions are welcome! Please feel free to open an issue or submit a pull request for any improvements or fixes you'd like to see.
This project is licensed under the Apache 2 License - see the LICENSE file for details.