You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug:
In the NutShell RISC-V implementation, the amomax.w instruction does not correctly update memory with the maximum value as specified in the RISC-V unprivileged ISA specification. Specifically, when executing amomax.w a1, a5, (a3) with the value at the address contained in a3 (a positive number) being greater than the value in a5 (a negative number), the expected behavior is to leave the memory at (a3) unchanged since the value at (a3) is already the maximum. Instead, NutShell erroneously updates the memory at (a3) with the value of a5 (the negative number), suggesting a possible incorrect implementation of signed comparison in amomax.w. This behavior is observed by executing ld a4, 0(a3) afterwards, where a4 ends up containing the smaller (negative) value, indicating that amomax.w stored a5's value instead of maintaining a3's. This issue contrasts with the expected behavior and the correct handling by Spike simulator.
To Reproduce:
Prepare a scenario where the memory at (a3) contains a positive value, and a5 contains a negative value.
Execute amomax.w a1, a5, (a3).
Follow with ld a4, 0(a3) to check the value at (a3).
Observe that a4 contains the negative value from a5, indicating that the memory at (a3) was incorrectly updated.
Expected Behavior:
According to the RISC-V unprivileged ISA specification, amomax.w should atomically load the value from the address contained in rs1, compare it with the value in rs2, and write the maximum of the two values back to the memory address in rs1. In the given scenario, since the memory at (a3) contains a greater value than a5, the memory content should remain unchanged, reflecting the correct maximum value determination. Subsequent checks, such as ld a4, 0(a3), should reveal that a4 retains the original, larger (positive) value from (a3), ensuring adherence to the specification.
Screenshots
Additional context
None
The text was updated successfully, but these errors were encountered:
Describe the Bug:
In the NutShell RISC-V implementation, the
amomax.w
instruction does not correctly update memory with the maximum value as specified in the RISC-V unprivileged ISA specification. Specifically, when executingamomax.w a1, a5, (a3)
with the value at the address contained ina3
(a positive number) being greater than the value ina5
(a negative number), the expected behavior is to leave the memory at (a3
) unchanged since the value at (a3
) is already the maximum. Instead, NutShell erroneously updates the memory at (a3
) with the value ofa5
(the negative number), suggesting a possible incorrect implementation of signed comparison inamomax.w
. This behavior is observed by executingld a4, 0(a3)
afterwards, where a4 ends up containing the smaller (negative) value, indicating thatamomax.w
storeda5
's value instead of maintaininga3
's. This issue contrasts with the expected behavior and the correct handling by Spike simulator.To Reproduce:
a3
) contains a positive value, anda5
contains a negative value.amomax.w a1, a5, (a3)
.ld a4, 0(a3)
to check the value at (a3
).a4
contains the negative value froma5
, indicating that the memory at (a3
) was incorrectly updated.Expected Behavior:
According to the RISC-V unprivileged ISA specification,
amomax.w
should atomically load the value from the address contained inrs1
, compare it with the value inrs2
, and write the maximum of the two values back to the memory address inrs1
. In the given scenario, since the memory at (a3
) contains a greater value thana5
, the memory content should remain unchanged, reflecting the correct maximum value determination. Subsequent checks, such asld a4, 0(a3)
, should reveal thata4
retains the original, larger (positive) value from (a3
), ensuring adherence to the specification.Screenshots
Additional context
None
The text was updated successfully, but these errors were encountered: