Skip to content

Common field reference table #203

@drom

Description

@drom

Currently, the named fields are belong to each instruction and don't carry instruction based semantics.

Here is example of addi instruction with rs1, rd, imm

addi:
  long_name: Add immediate
  description: Add an immediate to the value in rs1, and store the result in rd
  definedBy: I
  assembly: xd, xs1, imm
  encoding:
    match: -----------------000-----0010011
    variables:
    - name: imm
      location: 31-20
    - name: rs1
      location: 19-15
    - name: rd
      location: 11-7

Does it make sense to specify reference from each instruction into common reference table that will carry more detailed information about the field (type, zero/sign extension, addressing mode, source/destination, etc.)
Here is how the table could look like:

https://github.com/drom/riscv/blob/master/lib/fieldo.js

This information could be elaborated inside the instruction when flat form is needed.

addi:
  long_name: Add immediate
  description: Add an immediate to the value in rs1, and store the result in rd
  definedBy: I
  assembly: xd, xs1, imm
  encoding:
    match: -----------------000-----0010011
    variables:
    - {$ref: 'fieldo.json/imm12'}
    - {$ref: 'fieldo.json/rs1'}
    - {$ref: 'fieldo.json/rd'}

Also, looking at the large usage counts of some fields, it might be important to know that some set of instructions share semantics of some field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions