Where are the actual RISC-V instruction codes?

Phil Wright picture Phil Wright · Aug 31, 2016 · Viewed 8.7k times · Source

I have downloaded the latest...

RISC-V Instruction Set Manual, Volume 1: User-Level ISA

...which is interesting but it never actually gives values for the opcodes/funct3 and other instruction formats. For example, the LOAD/STORE/BRANCH opcodes are listed by name but it does not provide the actual bit values they represent.

Where are all the codes actual listed?

Answer

seanhalle picture seanhalle · Sep 19, 2016

They are also already conveniently encoded in the source code of the sodor project:

https://github.com/ucb-bar/riscv-sodor

for constants that capture the bit patterns in various useful ways, see:

src/common/instructions.scala

or, directly from the browser:

https://github.com/ucb-bar/riscv-sodor/blob/master/src/main/scala/common/instructions.scala