Kernel Development
Write your own Sparsr kernels.
This path is for people who want to program the Sparsr processor directly. You install the Sparsr SDK and write a kernel, then call it from a host application in C or C++.
You need the SDK for this path, and a RISC-V cross-compiler if your kernel is written in C. If you only want to use a library that is already built on Sparsr, you need none of it. Go back to the home page and pick the path that matches what you are building.
Write your kernel in C. A C kernel is RV32I plus the wide instructions. A stock RISC-V
compiler builds it, and it runs on the Sparsr VM. If you would
rather write the instruction stream yourself, write RISC-V assembly in a .S file. It
targets the same device a C kernel does.
The FPGA is part-way through a move to RV32I, so target the VM for now. Its scalar half decodes a subset of RV32I as of September 2026, and its wide half decodes the wide instructions in their RISC-V form. The Instruction Set page says exactly which instructions each side runs today.
Pages in this chapter
- Getting Started - install the SDK and run your first kernel.
- Writing a Kernel in C - a kernel is ordinary C. Start here.
- Writing a Kernel in RISC-V Assembly - an RV32I
.Skernel that uses the wide-instruction macros insparsr.S. - Host App Development - how your program feeds the device and starts a kernel.
- Tooling and CLI Reference -
spasmandsparsr-vm. - API Reference - every host function in
sparsr.h.
The Reference chapter has the architecture, the memory model, the instruction set, and the two software devices. Kernel authors read all of it.