I´m working with floating point numbers in System Generator. I need to perform this arithmetic operation y = x*(-1) . I think it could be done by using the mult block, but I don´t like this way because is very expensive in terms of FPGA demanded resources. So I was wondering if there is any block to perform some kind of data conversión. The only thing is needed to do is to change one bit. Does anyone know how to change the sign a floating point number using a reasonable way? Thank you so much.

  • \$\begingroup\$ Interesting that this question came within hours of electronics.stackexchange.com/questions/9941/…. Homework, perhaps? \$\endgroup\$ Feb 10, 2011 at 15:49
  • \$\begingroup\$ More or less, is part the reflexions I have doing a undergraduate thesis project. \$\endgroup\$
    – Peterstone
    Feb 11, 2011 at 6:17
  • \$\begingroup\$ Really? I was starting to get the impression we were doing your undergraduate thesis project ;) \$\endgroup\$
    – drxzcl
    Feb 14, 2011 at 0:23

1 Answer 1


Negating a floating point number involves inverting the sign bit.

(For fixed-point numbers there's a Negate block in the sysgen library which should avoid using a multiplier)

Be aware though, that sysgen is not designed for use with floating-point - you might find yourself jumping through all sorts of hoops!

  • 2
    \$\begingroup\$ No, negating a floating point number involves swapping the sign bit. The mantissa is always unsigned. As Peterstone said, the only thing that needs to be done is change one bit. \$\endgroup\$ Feb 10, 2011 at 14:26
  • \$\begingroup\$ Doh! You're quite right - not sure what I was thinking then! All that needs inverting is the sign bit. But not the whole bit pattern! \$\endgroup\$ Feb 10, 2011 at 21:30
  • \$\begingroup\$ Yeah, "not the whole bit pattern" you are right...Sorry I´ve done that and it works more or less, even the reason it´s not clear...I take it as a provisional solution.If anybody could tell me how can acess to just one bit, the sign bit... \$\endgroup\$
    – Peterstone
    Feb 11, 2011 at 6:21
  • \$\begingroup\$ I corrected your answer as we discussed in the comments - You can use the "edit" link if you can add some more information or make a correction to your answer. \$\endgroup\$ Feb 13, 2011 at 21:47
  • \$\begingroup\$ @reemrevnivek: Many thanks - I've added a small tweak \$\endgroup\$ Feb 15, 2011 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.