Skip to content

Searching for explainations to define a new instruction in the "struct riscv-opcode " #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arkhan91 opened this issue Jun 20, 2018 · 4 comments

Comments

@arkhan91
Copy link

arkhan91 commented Jun 20, 2018

Hi,

I am trying to interpret the statements mentioned in "const struct riscv_opcode riscv_opcodes[]" in riscv-opc.h.
for example

const struct riscv_opcode riscv_opcodes[] =

{
/* name,      isa,   operands, match, mask, match_func, pinfo.  */
....
{"and",       "I",   "d,s,j",  MATCH_ANDI, MASK_ANDI, match_opcode, INSN_ALIAS },
....
{"add",       "I",   "d,s,t",  MATCH_ADD, MASK_ADD, match_opcode, 0 }
....
} ````

Is there any document or source where i can find how to pass right statement specially operands.
I trying to append the custom instruction . 
 
@aswaterman
Copy link
Collaborator

Not really, as this is an internal interface. I suggest finding an instruction that has identical operand formats and copying it.

Adding new operand formats requires modifying several places in tc-riscv.c and riscv-dis.c. I wouldn't recommend it unless truly necessary.

@arkhan91
Copy link
Author

Can you please elaborate meaning of general operands like "d,s,t" ,"d,s,j" etc,
thanks

@aswaterman
Copy link
Collaborator

I can’t document them all, but offhand I know that:

d = integer rd
s = integer rs1
t = integer rs2
j = 12-bit I-type immediate

@TommyMurphyTM1234
Copy link
Collaborator

This is a list of all issues logged that I can find that relate to adding new instructions to the toolchain:

At this stage in the evolution of RISC-V,the majority of instruction addition will be done under the auspices of the relevant groups working on standardising, prototyping, and implementing/enhancing RISC-V extensions and their corresponding instructions. As such, there should be less of a demand for others to do so.

However, where somebody still wants to implement a non stadard custom extension/instruction here are some useful resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants