- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a range of integer values coming into my system in a two's complement format (positive and negative values). I run these through the altfp_convert module to make these integers floating point values. I do various mathematical operations with them, using other altfp modules. At the end, I use the altfp_convert to return the floating point to an integer to be written out. I wanted to confirm that this conversion does not create a two's complement number, but a signed integer instead. I require a two's complement format to send out, and I wanted to make sure that I would have to change the output of the altfp_convert module. Thanks!Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The output is a 2s compliment number - 2s compliment is a signed format - ie. MSB tells you the sign.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure, I've just noticed that I don't see the leading ones that I'd expect in a negative two's complement number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then I suspect the output is always +ve
Is there any reason you're using floating point? it's very costly to implement in terms of logic and latency. Fixed point is much cheaper.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page