Hi All,
I'm writing some code that reflects on riscv-opcodes to auto-generate
headers and code however I'm missing some information that allows me to
automate the task completely, in particular detecting whether an
instruction is RV32, RV64 or both. I want to avoid hand coding this.
Also noting the parse-opcodes python script
<
https://github.com/riscv/riscv-opcodes/blob/master/parse-opcodes>
contains the instruction set groupings and some of the encoding type
information (not all of the information is in the opcodes files) and
that the RV128 instructions are not yet present in the opcodes files. I
suspect the latter may not be a pressing issue.
The issues I am having are:
* instruction set membership cannot be reflected (RV32, RV64), (I, M,
A, F, D)
* shift instructions mask sizes can't be distinguished for RV32, RV64
* compressed instructions have almost no encoding type information at all
* csr listings are not available in a parsable format
Initially I am wondering about adding tags to riscv-opcodes so that
instruction set membership can be reflected (this is my immediate problem):
* rv32i
* rv64i
* rv32m
* rv64m
* rv32a
* rv64a
* rv32f
* rv64f
* rv32d
* rv64d
Instead of:
addi rd rs1 imm12 14..12=0 6..2=0x04 1..0=3
addiw rd rs1 imm12 14..12=0 6..2=0x06 1..0=3
slli rd rs1 31..26=0 shamt 14..12=1 6..2=0x04 1..0=3
@slli.rv32 rd rs1 31..25=0 shamtw 14..12=1 6..2=0x04 1..0=3
We could have:
addi rd rs1 imm12 14..12=0 6..2=0x04 1..0=3 rv32i rv64i
addiw rd rs1 imm12 14..12=0 6..2=0x06 1..0=3 rv64i
slli rd rs1 31..26=0 shamt5 14..12=1 6..2=0x04 1..0=3 rv32i
slli rd rs1 31..26=0 shamt6 14..12=1 6..2=0x04 1..0=3 rv64i
Just a thought at present. Let me know if you think it is a good idea
and I can work on it in my spare time. There are also the RV128
instructions to add...
Regards,
Michael.