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 Report] Wrong sign bit when 0 is multiplied by a negative number #92

Open
zhangkanqi opened this issue May 22, 2024 · 3 comments
Open

Comments

@zhangkanqi
Copy link

Environment:

RSD version: bd7c5c1


Bug Description:

There is an instruction fmul.s ft9, fs4, ft8, where fs4=0x00000000 and ft8=0x998a3664.

After the fmul.s instruction, the result of ft9 in RSD is 0x00000000. However, the result in spike is 0x80000000.


It seems that RSD mistakes the sign bit of the final result?

@zhangkanqi zhangkanqi changed the title [Bug Report] Wrong sign bit when 0 multiplied by a negative number [Bug Report] Wrong sign bit when 0 is multiplied by a negative number May 22, 2024
@lpha-z
Copy link

lpha-z commented Jun 1, 2024

Thank you for finding the bug.

@ RSD team: Fix the following 32'h00000000 to 32'h80000000. The identity element of floating-point addition is -0.0, not +0.0.

            if(fpuCode[i] == FC_MUL) begin
                fmaAddend[i] = 32'h00000000;
            end

https://github.com/rsd-devel/rsd/blob/master/Processor/Src/Pipeline/FPBackEnd/FPExecutionStage.sv#L180

@zhangkanqi
Copy link
Author

Thanks for your confirmation!

@lpha-z
Copy link

lpha-z commented Jun 1, 2024

We reopen this report because this bug has not been fixed yet.
When we finish fixing, we will close this report.

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