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

conversion of negative floating point number in binary using VHDL

Altera_Forum
Honored Contributor II
1,486 Views

I was literally stuck witha problem regarding the conversion of negative floating point number in binary and to write it in VHDL.For example the num is -0.8.when i convert it into binary it is like .11001100.since it is -ve i have to convert it into 2's complement and to provide the extra MSB bit. 

My question is that how to represent it in VHDL without using that decimal point.Plz kindly help me in this regard.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
665 Views

Floating point formats usually use a separate bit for the sign (so you have separate encodings for +0 and -0). 

You might be much better off using 'fixed point' arithmetic - where you multiply the FP numbers by a constant and then process the integer part (using 2's compliment integer arithmetic).
0 Kudos
Altera_Forum
Honored Contributor II
665 Views

If you don't use floating point, you'll most likely refer to a fixed point format with a specific number of fractional bits. You need to define the used format before converting to it.

0 Kudos
Reply