cva6 icon indicating copy to clipboard operation
cva6 copied to clipboard

How to Implement and Use a Custom Instruction in CVA6

Open mrbilandi opened this issue 1 year ago • 2 comments

Hi

I want to implement a new instruction, but I can't find a clear explanation of how to do it. Is there any guide on how to add a custom instruction to the toolchain (I'm not sure where) and how to build our program with the new compiler?

The CVA6 already has an example coprocessor with the instruction "adds rs1, rs2(, rs3)." If I want to use this instruction in my code, how can I do that and how can I compile the code containing this instruction?

mrbilandi avatar Sep 11 '24 16:09 mrbilandi

Hello,

verif/regress/cvxif_verif_regression.sh and verif/tests/testlist_cvxif.yaml will guide you on how to compile and run a test with custom instructions. Most of those defined in the example coprocessor are defined in software in cvxif_macros.h

CVA6 will offload every instruction it can not decode to the CoreV-X-interface. This way you can easily implement custom instruction in your own coprocessor.

Gchauvon avatar Sep 18 '24 13:09 Gchauvon

👋 Hi there!

This issue seems inactive. Need more help? Feel free to update us. If there are no updates within the next few days, we'll go ahead and close this issue. 😊

github-actions[bot] avatar Oct 19 '24 02:10 github-actions[bot]