-
Notifications
You must be signed in to change notification settings - Fork 40
Add type instructions and encodings as a separate schema #686
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
Open
AFOliveira
wants to merge
11
commits into
main
Choose a base branch
from
AFOliveira/jsonSchemaType
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4f102d1
feat(type):Add type to instruction schema. Allows referencing to spec…
AFOliveira 1fda012
feat(type):Add instruction_type schema. Source of references to spec…
AFOliveira 0e9d619
Merge branch 'main' into AFOliveira/jsonSchemaType
AFOliveira 2209122
Fix pre-commit error on json schemas.
AFOliveira fc0d5b4
refactor(encoding schema): move encoding schema to shared schema_defs…
AFOliveira b98ba93
feat(schemas) : add subtype to the inst_schema and make it an optiona…
AFOliveira f2310a8
Merge remote-tracking branch 'origin/main' into AFOliveira/jsonSchema…
dhower-qc 501a67b
feat(schema): wip on instruction type/subtype
dhower-qc b7aa7e8
feat(ruby): understand instruction types/subtypes in Ruby
dhower-qc d43e0f0
refactor(schema): change 'direction' to 'access' in inst var type
dhower-qc bc2bf84
refactor(schema): changing to inheritance for instruction types
dhower-qc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_opcode_schema.json# | ||
|
||
$schema: inst_opcode_schema.json# | ||
kind: instruction_opcode | ||
name: OP-32 | ||
|
||
data: | ||
display_name: OP-32 | ||
value: 0b0111011 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_opcode_schema.json# | ||
|
||
$schema: inst_opcode_schema.json# | ||
kind: instruction_opcode | ||
name: funct3 | ||
|
||
data: | ||
location: 14-12 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_opcode_schema.json# | ||
|
||
$schema: inst_opcode_schema.json# | ||
kind: instruction_opcode | ||
name: funct7 | ||
|
||
data: | ||
location: 31-25 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_opcode_schema.json# | ||
|
||
$schema: inst_opcode_schema.json# | ||
kind: instruction_opcode | ||
name: opcode | ||
|
||
data: | ||
location: 6-0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# yaml-language-server: $schema=../../../schemas/inst_subtype_schema.json | ||
|
||
$schema: inst_subtype_schema.json# | ||
kind: instruction_subtype | ||
name: R-x | ||
|
||
data: | ||
type: { "$ref": "inst_type/R.yaml#" } | ||
subtype: { "$ref": "inst_subtype/R/R-x.yaml#" } | ||
$inherits: | ||
- inst_opcode/funct7.yaml#/data | ||
- inst_opcode/funct3.yaml#/data | ||
- inst_opcode/opcode.yaml#/data | ||
- inst_var/xs2.yaml#/data | ||
- inst_var/xs1.yaml#/data | ||
- inst_var/xd.yaml#/data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_type_schema.json# | ||
|
||
$schema: inst_type_schema.json# | ||
kind: instruction_type | ||
name: R | ||
description: R-type instructions usually have two source registers and one destination registers | ||
ThinkOpenly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
opcodes: | ||
funct7: | ||
location: 31-25 | ||
funct3: | ||
location: 14-12 | ||
opcode: | ||
location: 6-0 | ||
variables: | ||
rs2: | ||
location: 24-20 | ||
rs1: | ||
location: 19-15 | ||
rd: | ||
location: 11-7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_var_schema.json# | ||
|
||
$schema: inst_var_schema.json# | ||
kind: instruction_variable | ||
name: xd | ||
|
||
data: | ||
location: 11-7 | ||
type: { "$ref": "inst_var_type/x_dst_reg.yaml#" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_var_schema.json# | ||
|
||
$schema: inst_var_schema.json# | ||
kind: instruction_variable | ||
name: xs1 | ||
|
||
data: | ||
location: 19-15 | ||
type: { "$ref": "inst_var_type/x_src_reg.yaml#" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_var_schema.json# | ||
|
||
$schema: inst_var_schema.json# | ||
kind: instruction_variable | ||
name: xs2 | ||
|
||
data: | ||
location: 24-20 | ||
type: { "$ref": "inst_var_type/x_src_reg.yaml#" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_var_type_schema.json# | ||
|
||
$schema: inst_var_type_schema.json# | ||
kind: instruction_variable_type | ||
name: x_dst_reg | ||
type: register_reference | ||
register_file: X | ||
access: W |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# yaml-language-server: $schema=../../schemas/inst_var_type_schema.json# | ||
|
||
$schema: inst_var_type_schema.json# | ||
kind: instruction_variable_type | ||
name: x_src_reg | ||
type: register_reference | ||
register_file: X | ||
access: R |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortuntely, "funct3" is not always at this location. It depends on the format. For example, CI, CSS, CIW, CL, CS all have a "funct3" at 15-13.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer we just drop the indirection or call it something like R-funct3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about something like this?
arch/inst_type/R.yaml
(unchanged)arch/inst_subtype/R-x.yaml
:arch/inst/Zba/add.uw.yaml
:etc.
So, R-x subtype inherits opcodes from the base type, R.
And
xs2
inherits attributes (just "location") from the base type R'srs2
.(I removed the top-level "inherits: OP-32" from "add.uw.yaml". Was that needed?)