Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Discussions

Two's Complement and Floating Point

Altera_Forum
Honored Contributor II
2,454 Views

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!
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,732 Views

The output is a 2s compliment number - 2s compliment is a signed format - ie. MSB tells you the sign.

0 Kudos
Altera_Forum
Honored Contributor II
1,732 Views

Sure, I've just noticed that I don't see the leading ones that I'd expect in a negative two's complement number.

0 Kudos
Altera_Forum
Honored Contributor II
1,732 Views

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.
0 Kudos
Reply