-
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
Improved Reserved Field Mechanism #35
base: json
Are you sure you want to change the base?
Conversation
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
This fixes the ci workflows. For now it is configured to runs exclusively on ocaml version`5.0.0`, unlike the upstream which also uses `4.08.1`. Support for earlier versions will be added gradually.
The tail end of the new "functions" content from commit 4aa4024 has a lingering comma after the last element: ``` { "name": "riscv_f32Div", "source": "{\n [...]}" }, ] } ``` Fix this by using `String.concat` to join the "function" elements with a comma between them, instead of emitting each of them with a trailing comma.
* CI for JSON validation. Fixes ThinkOpenly#30. * Run build CI on new pull-request.
(Waiting for @ThinkOpenly to approve workflows.) |
Signed-off-by: Joydeep Tripathy <[email protected]>
Signed-off-by: Joydeep Tripathy <[email protected]>
I think there should be no problem here. jd@jd-virtual-machine:~/Desktop/New Folder/sail$ git checkout reserved-fields
Branch 'reserved-fields' set up to track remote branch 'reserved-fields' from 'origin'.
Switched to a new branch 'reserved-fields'
jd@jd-virtual-machine:~/Desktop/New Folder/sail$ make
dune build --release
(cd _build/default/src/lib && /home/jd/.opam/default/bin/ott -sort false -generate_aux_rules true -o ast.lem -picky_multiple_parses true ../../language/sail.ott)
Ott version 0.33 distribution of Mon 16 Jan 15:32:01 GMT 2023
(cd _build/default/src/lib && /home/jd/.opam/default/bin/ott -sort false -generate_aux_rules true -o jib.lem -picky_multiple_parses true ../../language/jib.ott)
Ott version 0.33 distribution of Mon 16 Jan 15:32:01 GMT 2023
jd@jd-virtual-machine:~/Desktop/New Folder/sail$
|
CI is failing with the error message :
Which is totally unrelated to the changes I made. There is no error when I am running it using |
If I understand correctly, this is only failing in the macOS-12 build, and not macOS-latest, nor ubuntu-latest. Given how OS-agnostic this project is, I think we should drop macOS-12 from CI if it causes us any issues. The failure you are seeing appears to be some dependency is installed at a level where |
Yes. Should I make the changes in the GH Action to drop that particular job? |
Also, If it is required in the future, we could replace let is_reserved_field field_name =
let reserved_prefix = "reserved_bits_" in
String.length field_name >= String.length reserved_prefix
&& String.sub field_name 0 (String.length reserved_prefix) = reserved_prefix This also checks if the reserved bits string starts with the substring |
That would be fine with me, yes. |
The macos-12 4.08.1 build has been removed from CI. |
Changes in support of ThinkOpenly/sail-riscv#24