Skip to content

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

@youzi27

Description

@youzi27

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions