4. Adding Support for new Instructions¶
This section details the steps for adding support for new instructions in RISCV-ISAC.
4.1. Update the Parser-Module¶
The first step is to update the parser-module to be able to deduce the relevant fields of the new
instruction and create the required instructionObject()
.
As part of this phase, the contributor will first have to add a function(s) which will decode the
instruction hexadecimal encoding and extract the parameters of the instructionObject()
.
Make sure to follow the same code structure as used by other functions in module.
Currently the top level function that get’s called by the coverage module is the
parseInstruction()
function. This function based on the instruction length
encoding scheme defined by the RISC-V ISA spec identifies the length of the instruction. If the
instruction is compressed then the parseCompressedInstruction()
function
is called, else the parseInstruction()
function is called.
If the new instruction(s) being added belong to the non-compressed opcodes, then the particular
entry in OPCODES()
needs to be updated to point to the new function(s)
defined earlier. If there are instructions falling into the compressed op-code space then the
functions quad0()
, quad1()
or quad2()
will need to be updated accordingly.
4.2. Update the Architectural¶
The coverage module maintains its own architectural state : integer register file, program counter,
floating point register file, etc. If the new instruction(s) requires an additional architectural
state, then that needs to be added in archStats()
and the usage needs to
be updated in compute_per_line()
.