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

'amomin.w' Instruction Fails to Update Memory with Minimum Value #180

Open
youzi27 opened this issue Mar 6, 2024 · 0 comments
Open

'amomin.w' Instruction Fails to Update Memory with Minimum Value #180

youzi27 opened this issue Mar 6, 2024 · 0 comments

Comments

@youzi27
Copy link

youzi27 commented Mar 6, 2024

Describe the Bug:
In NutShell's implementation of the RISC-V ISA, the amomin.w instruction behaves incorrectly under certain conditions. Specifically, when executing an instruction like amomin.w a2, t1, (a7), if the value in t1 is less than the value at the address contained in a7, the expected behavior is to store the value of t1 at the address pointed to by a7. However, it has been observed that NutShell fails to perform this memory update operation. Subsequent load operations, such as lw a3, 0(a7), confirm that the memory at (a7) retains its old value, indicating that the minimum value was not stored as expected. This behavior contrasts with Spike's correct handling of the same instruction sequence.

To Reproduce:

  1. Set up an environment where t1 < (value at address a7).
  2. Execute amomin.w a2, t1, (a7).
  3. Follow with lw a3, 0(a7) to load the value from (a7) into a3.
  4. Observe that a3 contains the old value from (a7), indicating that amomin.w did not update the memory with the minimum value.

Expected Behavior:
The amomin.w instruction should atomically load the value from the address contained in rs1, compare it with the value in rs2 (in this case, t1), and write the smaller of the two values back to the memory address in rs1 (here, (a7)). This process ensures atomic read-modify-write operations crucial for multiprocessor synchronization. Upon executing lw a3, 0(a7) after amomin.w a2, t1, (a7), a3 should contain the new, smaller value, reflecting the successful memory update by amomin.w​​.

Screenshots
image

Additional context
None

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