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] Unexpected Rounding Behavior During fsqrt.d Execution #2057

Open
1 task done
youzi27 opened this issue Apr 18, 2024 · 2 comments
Open
1 task done

[BUG] Unexpected Rounding Behavior During fsqrt.d Execution #2057

youzi27 opened this issue Apr 18, 2024 · 2 comments
Labels
notCV32A65X It is not an CV32A65X issue PARAM:FPU Issue depends on the FPU parameter Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system

Comments

@youzi27
Copy link

youzi27 commented Apr 18, 2024

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

In some rounding mode, precision errors occur when calculating fsqrt.d. And the results differ from those of Spike.
Testing has shown that RDN, RUP, RMM and DYN all experience rounding errors.

How to reproduce and the logs are as follows:
Example:
Initialize fa7 with 0x402e000000000000 and execute fsqrt.d ft10, fa7.
Under RDN, DYN Mode:

Spike results are: ft10 = 0x400efbdeb14f4eda
CVA6 results are: ft10 = 0x400efbdeb14f4ed9

Under RUP , RMM Mode:
Spike results are: ft10 = 0x400efbdeb14f4ed9
CVA6 results are: ft10 = 0x400efbdeb14f4eda

@youzi27 youzi27 added the Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system label Apr 18, 2024
@youzi27 youzi27 changed the title [BUG] The result of fsqrt.d is incorrect. [BUG] Unexpected Rounding Behavior During fsqrt.d Execution Apr 18, 2024
@JeanRochCoulon JeanRochCoulon added the notCV32A65X It is not an CV32A65X issue label Apr 18, 2024
@youzi27
Copy link
Author

youzi27 commented Apr 20, 2024

The vulnerability of the rounding mode mentioned above also occurs in the fdiv instruction.

Example:
When executing the instruction fdiv.d fs9, fs10, fa4 with the following register values:

fs10 = 0x41ddc16575c00000
fa4  = 0x41e0000c09000000

The results differ between CVA6 and Spike simulator as follows:
Round Toward Zero (RTZ) Mode:
CVA6 Result: 0x3fedc14f1407f47f
Spike Result: 0x3fedc14f1407f47e (correct value as verified)
Round Up (RUP), Round to Nearest, Tie to Max Magnitude (RMM), and Dynamic (DYN) Rounding Modes:
CVA6 Result: 0x3fedc14f1407f47e
Spike Result: 0x3fedc14f1407f47f

@JeanRochCoulon JeanRochCoulon added the PARAM:FPU Issue depends on the FPU parameter label Apr 22, 2024
@JeanRochCoulon
Copy link
Contributor

This Github issue can also be reported on cvfpu side, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notCV32A65X It is not an CV32A65X issue PARAM:FPU Issue depends on the FPU parameter Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system
Projects
None yet
Development

No branches or pull requests

2 participants