I want to convert a floating point number to a integer number. Basically I have a floating point number between 1 and 0, with three decimal places, and I want to pass it to a integer number as if multiplied by 1000. I suspect there should be a more optimal way to do it than using the arithmetic multiply operation x1000.
I'm looking for a piece of code preferably.
Electronic – How to convert a floating point number to integer, using VHDL
floating pointvhdl
Best Answer
Well, since you don't want to use a power of two for your multiplication, it's going to be a PITA. I'll show you what would be more ideal after answering your question. I'm not going to provide any code - just technique.
The Hard Way (x 1000)
The Easy Way (x 1024)