Open
Description
RISC-V "V" Vector Extension (shorten as RVV
) is the instruction extension that introduces vector process capabilities to RISCV.
The staged goal of this issue is to explore the possibility to run RVV instructions with rv32emu.
- Configure
vtype
andvl
CSRs with vsetvli/vsetivli/vsetvl. This is required because RVV vector register is variable-legnth. - Unit-Stride store/load instructions. This can help us to build the minimum POC.
- Basic integer ALU instructions ( vadd, vsub, vmin, vmax, vand, vor, vxor) and permutation instructions (vrgather, vslideup, vslidedown)
To achieve the goals we need to
- Implement the instruction decoder (in
decode.c
). This decoder should be able to decode all three instructions formats (valu, vcfg, vmem) - Add the corresponding CSRs (
vl
,vtype
) - Implement RVV instructions into custom IRs. Some of RVV may be implemented as a loop of basic instructions (like
vadd
fromadd
). To maintain the readability of throughout the entire codebase, adding a new src filervv_template.c
for the RVV's IRs may be a better idea. - Study the further implementations (exception handling, rounding mode, float-points, comparison, mask instructions, etc.)
We can refer the following resource
- RVV spec https://github.com/riscv/riscv-isa-manual/blob/main/src/v-st-ext.adoc
- instruction tables https://github.com/riscv/riscv-isa-manual/blob/main/src/images/wavedrom/v-inst-table.edn
- alu instructions formats https://github.com/riscv/riscv-isa-manual/blob/main/src/images/wavedrom/valu-format.edn
- vector configuration instructions format https://github.com/riscv/riscv-isa-manual/blob/main/src/images/wavedrom/vcfg-format.edn
- Spike's bit masks for decoding instructions https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/encoding.h