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

[Bug report] Incorrectly Executes C.ADDI4SPN with nzuimm=0 #172

Open
youzi27 opened this issue Feb 29, 2024 · 0 comments
Open

[Bug report] Incorrectly Executes C.ADDI4SPN with nzuimm=0 #172

youzi27 opened this issue Feb 29, 2024 · 0 comments

Comments

@youzi27
Copy link

youzi27 commented Feb 29, 2024

Describe the bug
The RISC-V specification in Section 16.5 clearly states that

C.ADDI4SPN is only valid when nzuimm=0; the code points with nzuimm=0 are reserved.

the C.ADDI4SPN instruction is only valid when nzuimm!=0, with the code points where nzuimm=0 being reserved, implying that executing C.ADDI4SPN with nzuimm=0 should result in an illegal instruction exception. While the SPIKE simulator correctly implements this behavior by throwing an illegal instruction exception, the NutShell processor implementation deviates from this specification by executing c.addi4spn a2, sp, 0 without any errors, thereby failing to comply with the RISC-V standards.

To Reproduce

  1. On the NutShell processor, compile and run a RISC-V assembly program containing the instruction c.addi4spn a2, sp, 0.
  2. Observe that the instruction executes successfully, which is contrary to the expected behavior as per the RISC-V specification.

Expected behavior
Per the RISC-V specification, attempting to execute C.ADDI4SPN with nzuimm=0 should result in an illegal instruction exception. The expected behavior for both SPIKE and NutShell is to reject the execution of c.addi4spn a2, sp, 0 by throwing an illegal instruction exception, maintaining consistency with the RISC-V ISA specification and ensuring that reserved code points are not executed.

Screenshots
image

Environment (optional, if necessary):
OS: Ubuntu 22.04.3 LTS
Compiler: gcc 11.4.0

Additional context
None

@youzi27 youzi27 changed the title Incorrectly Executes C.ADDI4SPN with nzuimm=0 [Bug report] Incorrectly Executes C.ADDI4SPN with nzuimm=0 Feb 29, 2024
@youzi27 youzi27 closed this as completed May 22, 2024
@youzi27 youzi27 reopened this May 22, 2024
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

No branches or pull requests

1 participant