Adding custom instruction to RISCV toolchain


I want to add one custom instruction to RISCV compiler and assembler, so that when i compile my c program, the compiler can emit this custom instruction. Is it easy to add a custom instruction ? can u send some example or any article which describes the steps how to do this? Any inputs would be helpful

Hi - this is not a trivial thing but there is a discussion on that topic here.

As you may know you can use the .insn or .word GCC directive to formulate the instruction, but the debugger won’t know anything about it, and from what it sounds like, you are trying to avoid this (example here).