converting floating point number to integer and vice versa

Jan 04, 2008 5 Replies

I want to write a function to



1) convert single precision 32 bit floating point number to integer and return integer
2) convert integer to single precision floating point number and return 32 bit floating point

What are the parameters I should give to each functions and what logic do I use for both the functions.



Do i need to write seperate function for signed and unsigned numbers?



Your help would be appreciated


Is this homework / an assignment?

do we get the diploma if we answer or does it still go to you?

At least you are honest.

I would suggest you search the web first since there is a lot of stuff available on-line and then come back with specific questions.

If you know a bit of C/C++ then I would suggest you also look at GCC's floatlibc.c which contains these 2 functions, if you understand them then translating them to VHDL shouldn't be too difficult.

Good luck! Hans

formatting link

I would suggest "+float +vhdl" and take the first hit in google for a careful inspection.

bye Thomas

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required