forked from rems-project/sail
-
Notifications
You must be signed in to change notification settings - Fork 12
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
fixes encodings #25
Draft
snapdgn
wants to merge
23
commits into
ThinkOpenly:json
Choose a base branch
from
snapdgn:fix/bad-opcodes
base: json
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.
Draft
fixes encodings #25
Conversation
This file contains 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
In the JSON backend, currently all messages (debug text and JSON data) are emitted to stdout. Change debug messages to be emitted to stderr by using `prerr_endline` instead of `print_endline`. Fixes ThinkOpenly#4.
In the JSON Backend, currently all the debug output is emitted to stderr by default. Introduce a conditional environment variable `DEBUG_OUT` to control debug output. Fixes ThinkOpenly#6.
New JSON field "syntax" which facilitates displaying parenthesized operands in syntax like "lw rd,offset(rs)". Extract operands from assembly representation ("mapping clause assembly") instead of function signatures ("union clause ast"). Remove "identity" functions in assembly representation. In actuality, these functions transform an opcode field into the expected assembly representation, which could be a well-known register name or the actual value of an offset where the field is a truncated representation. Hardcoding these Sail function names here is at least far from ideal, and at worst, wrong (calling a truncated value and the full value the same name). More thought is needed as to the best realization of assembly syntax from the assembly representation. Ignore "opt_spc" in assembly representations. Move function "dequote" up due to a new use.
Use the newly available `Reporting.loc_range_to_src` function to extract the text of the function bodies verbatim from the Sail source. Previously, the json contained the AST text for the functions.
Extract the instruction syntax from the `mapping clause assembly` (rather than presuming that the operands captured separately can accurately represent syntax. They can't.) Make sure to preserve separators (",") and parentheses.
A previous commit broke extraction of instruction operands/types. Fix it.
Many instructions are grouped around a similar, common implementation with the mnemonics embedded within a list of mnemonic:name mapping, such as: ``` mapping utype_mnemonic : uop <-> string = { RISCV_LUI <-> "lui", RISCV_AUIPC <-> "auipc" } mapping clause assembly = UTYPE(imm, rd, op) <-> utype_mnemonic(op) ^ spc() ^ reg_name(rd) ^ sep() ^ hex_bits_20(imm) ``` Add support for extracting instruction names from within the mappings if the names are added within as attributes, for example: ``` mapping utype_mnemonic : uop <-> string = { $[name Load Upper Immediate] RISCV_LUI <-> "lui", $[name Add Upper Immediate to Program Counter] RISCV_AUIPC <-> "auipc" } ```
This commit enhances the JSON Backend to properly handle instructions with optional operands. Previously, these operands were not handled correctly. The implementation introduces two new fields: `optional`, which indicates whether an operand is optional (boolean), and `default`, which holds the default value if no value is specified. for 'vle16.v': Before: ``` { "operands": [ ... { "name": "vm", "type": "bits(1)" } ... ] } ``` After: ``` { "operands": [ ... { "name": "vm", "type": "bits(1)", "optional": true, "default": "v0.t" } ... ] } ``` Fixes: ThinkOpenly#2
@snapdgn , are you still working on this? Do you need to hand this off? Not urgent, just checking in. |
Sorry @ThinkOpenly , just saw this. Gsoc thing is kinda taking up major chunk of my time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: #18
WIP