-
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
Does Sail or JSON need 32bit-specific encodings? #19
Comments
Hello @ThinkOpenly is this issue for discussion only or is it really a problem can you tell a little bit more |
While poking around in binutils, these instructions turned up as "32-bit specific" encodings:
The Sail code hides this distinction slightly, at least enough for the project to currently ignore it:
In the above representation,
(The "Note" in the comment there, is certainly relevant.) However, this is arguably different than what is specified in the current text ISA (20191213), as can be seen in the image at the end of the opening comment in this issue. There, The question to be resolved here is if it really matters. Pedantically, it matters: if the JSON should match the text ISA spec, So, practically, it can be ignored. The disadvantage to ignoring, though, is that the JSON cannot be used to generate the content for projects like binutils (or binutils would have to similarly ignore this case). |
Hey @ThinkOpenly |
I'll need more details to answer this. What do you mean by "set a bit range for |
i think i misunderstood just trying to familiarise myself with sail |
|
Did this discussion move to the RVI Slack channel #team-sailing-downstream? It appears so to me. |
yeah @ThinkOpenly i got the answer |
Some instructions have different encodings between RV32 and RV64.
From the RISC-V ISA Specification (20191213), Chapter 24, "RV32I Base Instruction Set":

From the RISC-V ISA Specification (20191213), Chapter 24, "RV64I Base Instruction Set (in addition to RV32I)":

Note the first field is 7 and 6 bits, respectively, and the 2nd field ("shamt") is 5 and 6 bits, respectively.
Anecdotally, the "binutils" project treats these differently (from "include/opcode/riscv-opc.h"):
From a practical standpoint, however, it's not clear that a distinction is necessary. The "shamt" field in these cases is located such that the if "shamt" was extended by another bit on the left, it would be the lowest order bit of the first field, and for "SLLI", "SRAI", and "SRLI", that bit is always zero:

The text was updated successfully, but these errors were encountered: