Skip to content
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

Support RVC hint instructions rather than trap #31

Closed
wants to merge 1 commit into from

Conversation

jrtc27
Copy link
Collaborator

@jrtc27 jrtc27 commented Dec 23, 2019

No description provided.

Comment on lines +239 to +240
mapping clause encdec_compressed = C_SRLI64(rsd)
<-> 0b100 @ 0b0 @ 0b00 @ rsd : cregidx @ 0b00000 @ 0b01
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this (and the other new C_x64 instructions below) have a guard on the architecture being RV128 (i.e. sizeof(xlen) == 128) similar to the guards in SHIFTIOP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they're hints in RV32/RV64.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the exception is RV128, where an immediate of 0 expands to srli rd, rd, 64 etc)

Copy link
Contributor

@pmundkur pmundkur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would have been nice to have an explicit indicator for hints, and removing the guards in this way hides the hint variants. On the other hand, trapping is bad. Perhaps we should add a comment indicating the hint case where the hint guards have been removed.

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Jan 7, 2020

We don't do that for all the various ways of writing NOP in the base instruction set, which also has a well-defined set of reserved for standard use and reserved for custom use hints. I think it would be misleading to add that for the compressed case.

@pmundkur
Copy link
Contributor

pmundkur commented Jan 7, 2020

The spec has statements like "C.ADDI is only valid when rd/=x0 and nzimm/=0." When the spec is annotated with the Sail latex, it would be odd and confusing to see that statement not represented in some form in Sail.

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Jan 7, 2020

I think that’s a flaw in the spec though as it’s hard to reason about the validity of the hints. It should read the same as the base instruction set, which doesn’t say “ADDI is only valid when rd /= x0”. Such statements should be reserved for when it’s an illegal instruction, or a completely different instruction. I agree there’s a disparity now between the Sail and the prose part of the spec, but I’d argue that’s a deficiency in the spec.

@pmundkur
Copy link
Contributor

pmundkur commented Jan 8, 2020

I agree that it is a deficiency in the phrasing of the spec. Could you open an issue on the spec repo explaining this? I'm reluctant to have Sail diverge from the prose spec, and would rather see that spec fixed first.

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Jan 8, 2020

Ok, I will do so tomorrow.

@PeterSewell
Copy link
Collaborator

PeterSewell commented Jan 8, 2020 via email

@scottj97
Copy link
Contributor

Was there ever an issue opened on the ISA spec? I can't find anything there.

@pmundkur
Copy link
Contributor

pmundkur commented Sep 9, 2020

Could I close this given the hint support now in master?

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Sep 9, 2020

Well the assembly for those is wrong, and the SRLI is called SRLI64 in the spec.

@martinberger
Copy link
Collaborator

Well the assembly for those is wrong, and the SRLI is called SRLI64 in the spec.

@jrtc27 Do you know what the status of this is? It's been sitting here for a while.

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Oct 3, 2021

Well the assembly for those is wrong, and the SRLI is called SRLI64 in the spec.

@jrtc27 Do you know what the status of this is? It's been sitting here for a while.

Unchanged; the implementation is correct behaviour-wise as far as I recall, but the disassembly isn't right.

@martinberger
Copy link
Collaborator

the disassembly isn't right.

How about we close this PR and reopen, when this is fixed? @jrtc27

@jrtc27 jrtc27 closed this Oct 4, 2021
billmcspadden-riscv pushed a commit to billmcspadden-riscv/sail-riscv that referenced this pull request May 30, 2024
* update riscv_arch.h to support QEMU:
  add size attribute for tohost/fromhost
  add writing zero to (tohost + 4) to write_tohost

* revert the align of tohost/fromhost to 64 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants