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]There is an error in the implementation of mepc[0]. #149

Open
youzi27 opened this issue Dec 6, 2023 · 0 comments
Open

[Bug Report]There is an error in the implementation of mepc[0]. #149

youzi27 opened this issue Dec 6, 2023 · 0 comments

Comments

@youzi27
Copy link

youzi27 commented Dec 6, 2023

Description

Nutshell does not check whether mepc[0] is zero.
Described in the privileged specification 3.1.14:

The low bit of mepc (mepc[0]) is always zero.

Environment

Implementation: Nutshell
Test case: See attachment

Expected Behavior

When attempting to write a value to mepc, it is required that mepc[0] must be 0.

Observed Behavior

In Spike: when writing to mepc, the last bit is forcibly set to 0.
In Nutshell: It is not forcibly set to 0. This violates the specification.

Potential Impact

Not sure.

Result log display:

The assembly code context for 'mret' is as follows(Note:for more details, please refer to the attachment):

-                   la x14, 0 #To check
-                   addi x14,x14,1 #To check
-                   csrw 0x341, x14

mepc different at pc = 0x00800001a8, spike = 0x0000000000000000, Nutshell= 0x0000000000000001

I am looking forward to your insights and resolution on this matter. If I have any inaccuracies, please point them out. If you also consider this to be an issue, please let me know.

testcase.zip

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