-
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
Need a new mechanism for reserved fields #21
Comments
I am looking into this! |
There has been some good discussion provoked by @joydeep049's PR #24 , which I'll copy here...
|
In #24 (comment), @joydeep049 asks:
The actual required inventory of identity functions is currently very small (2: 5 bit and 12 bit fields for
|
Sure @ThinkOpenly , I'll give it a try! |
In #24 (comment), @joydeep049 asked:
There is some code emerging in ThinkOpenly/sail#17 that includes code similar to what is needed here. There is a function,
This function is operating on the stored (in a You'd want something similar, but operating on the stored representation of a field (in the |
I went through the sail code as mentioned above. let optional_operand k op =
(* Pattern to match maybe_* or reserved_bits_N functions *)
let pattern = regexp_case_fold ("\\|reserved_bits_[0-9]+\\)(" ^ op ^ ")") in
match Hashtbl.find_opt assembly_clean k with
| Some op_list -> extract_opt_operands_fn pattern op_list
| None -> None, "" Would this work? |
You're working in the routine that handles operands. This issue needs to be addressed in the routine that handles fields,
There are no optional fields, so the comment is misleading, and the code doesn't look for "maybe_*", either. So, that part of the comment could be removed. The syntax doesn't look quite correct to me. What is the leading Note carefully the function and accompanying comments in #21 (comment), including:
|
Apologies for the confusion! |
Sorry, I don't understand what it is you seek. If you are asking how to test changes, refer to the document you created a little while ago: https://github.com/ThinkOpenly/sail-riscv/blob/JSON/doc/JSON.md. |
I did not understand in which script I'm supposed to add the above suggested code that looks for functions like |
Let's walk through how to figure this out... The "fields" JSON content is emitted in The "encodings" Hashtbl is populated (
There are two parts to addressing this issue:
Lastly, make sure your changes build correctly and produce the expected results by following the "how to test changes" link in #21 (comment). I hope that helps! |
@ThinkOpenly |
That's a good question. There are two complementary repositories involved in the project with respect to this issue:
|
In the Sail definition ("model/riscv_insts_base.sail"), the opcode encoding for "FENCE.I" is defined:
... every bit is constant.
But, the current RISC-V ISA specification (20191213) says:
There needs to be some way to know that for these fields, they are currently expected to be zero, but that may change in the future.
An example from a downstream project, "binutils", respects the reserved fields for the purposes of decode (in "include/opcode/riscv-opc.h"):
If the entire opcode was constant, the mask would be like "EBREAK" (and others):
The text was updated successfully, but these errors were encountered: