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 #112

Open
youzi27 opened this issue Apr 22, 2024 · 2 comments
Open

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

youzi27 opened this issue Apr 22, 2024 · 2 comments

Comments

@youzi27
Copy link

youzi27 commented Apr 22, 2024

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

Moreover:

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

See: openhwgroup/cva6#2057

@pascalgouedo
Copy link

pascalgouedo commented Sep 6, 2024

Same answer than #110

@youzi27
Copy link
Author

youzi27 commented Sep 6, 2024

Please see the answer in #111.

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

2 participants