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

Getting wrong result on FMUL-S with DYN-RDN mode #54

Open
zeeshanrafique23 opened this issue Oct 18, 2021 · 1 comment
Open

Getting wrong result on FMUL-S with DYN-RDN mode #54

zeeshanrafique23 opened this issue Oct 18, 2021 · 1 comment

Comments

@zeeshanrafique23
Copy link

zeeshanrafique23 commented Oct 18, 2021

I am multiplying two numbers: rs1 = 0x00000000 and rs2 = 0x3a2b48ef.
I am getting the wrong result, the sign bit is high.
image

I am suspecting the error comes from this statement.
https://github.com/pulp-platform/fpnew/blob/0bfbeede0e01b2e44e41bb14c70a80efeffa1bbd/src/fpnew_rounding.sv#L68

@stmach @lucabertaccini

@zeeshanrafique23
Copy link
Author

This issue is resolved by making changes in the module fpnew_rounding module.
Before:

  assign sign_o = (exact_zero_o && effective_subtraction_i)
                  ? (rnd_mode_i == fpnew_pkg::RDN)
                  : sign_i;

After:

assign sign_o = (exact_zero_o && effective_subtraction_i)
                  ? ((rnd_mode_i == fpnew_pkg::RDN) & (op_i != fpnew_pkg::MUL))
                  : sign_i;

The op_i is taken as an input to this module to restrict the sing bit 0 while multiplying any two numbers where one the operand in +zero.
https://github.com/pulp-platform/fpnew/blob/0fc3620978a500303ce94811eec7839e427dc995/src/fpnew_rounding.sv#L70

zeeshanrafique23 added a commit to merledu/fpnew that referenced this issue Dec 11, 2021
Signed-off-by: Zeeshan Rafique <zeeshanrafique23@gmail.com>
zeeshanrafique23 added a commit to merledu/fpnew that referenced this issue Dec 11, 2021
Signed-off-by: Zeeshan Rafique <zeeshanrafique23@gmail.com>
zeeshanrafique23 added a commit to merledu/fpnew that referenced this issue Dec 11, 2021
Signed-off-by: Zeeshan Rafique <zeeshanrafique23@gmail.com>
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

1 participant