-
Notifications
You must be signed in to change notification settings - Fork 15
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
New instruction schema #285
base: main
Are you sure you want to change the base?
Conversation
I just have a couple questions on this:
|
Good questions. I think both of these can be addressed in how this relocation data gets tied to an encoding. For example, if we had something like: [ $schema: inst_variable_schema.json
kind: instruction variable
location: 31-20
# ...
elf_psabi_relocation: { $ref: relocation/R_RISCV_PCREL_LO12_I.yaml# }
pe_abi_relocation: # { ... } future Windows ABI [ # ...
encoding:
fields:
imm: { $ref: common/inst_variable/itype_imm.yaml# } Then we can tie as many relocations as needed to an instruction variable. We do probably need to add an This also handled the "not 0" case, since that's tied to the instruction variable. |
We should document the new relocations only. What is already documented in the RISC-V psABI (https://github.com/riscv-non-isa/riscv-elf-psabi-doc), we should skip. We should follow the psABI document format for recording the info, so that the resulting PDF has the same look and feel of the RISC-V psABI.
|
I've added a new attempt at an instruction schema. Here is an example: $schema: "inst_schema.json#"
kind: instruction
name: lb
long_name: Load byte
format: { $ref: inst_format/itype.yaml# } # the instruction format 'I-type'
# ...
assembly: xd, offset(rs1)
encoding:
match: -----------------000-----0000011
variables:
- field: { $ref: inst_format/itype.yaml#/fields/name=imm }
name: offset
- field: { $ref: inst_format/itype.yaml#/fields/name=rs1 }
name: xs1
- field: { $ref: inst_format/itype.yaml#/fields/name=rs1 }
name: xd
# ... and itype: $schema: inst_format.json#
kind: instruction format
name: I-type
size: 32
fields:
- location: 31-20
name: imm
kind: immediate
sign_extend: true
relocations:
- $ref: relocation/R_RISCV_PCREL_LO12_I.yaml#
- $ref: relocation/R_RISCV_TPREL_LO12_I.yaml#
- $ref: relocation/R_RISCV_TLSDESC_ADD_LO12.yaml#
- $ref: relocation/R_RISCV_LO12_I.yaml#
- location: 19-15
name: rs1
kind: x source register
- location: 14-12
name: funct3
kind: opcode
- location: 11-7
name: rd
kind: x destination register
- location: 6-0
name: opcode
kind: opcode
opcode: true
|
This PR is a WIP to discuss the structure of ELF relocations in the database. Eventually, we will tie these to the variables in instruction encodings.