Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integer to real conversion function

Is there a common conversion function to convert a integer type object to a real type in VHDL? This is for a testbench so synthesizability is a non-issue.

like image 466
ErikAndren Avatar asked May 02 '12 10:05

ErikAndren


People also ask

How do you convert int to real?

Instead of if x >= 0 then x else ~x , use Int. abs x . To convert x to real, use Real. fromInt x .

What is conversion function?

Conversion functions convert a value from one datatype to another. Generally, the form of the function names follows the convention datatype TO datatype. The fırst datatype is the input dataty; the last datatype is the output.

Which function converts value into integer?

Description. The atoi() function converts a character string to an integer value. The input string is a sequence of characters that can be interpreted as a numeric value of the specified return type.


1 Answers

You can convert integer to real as follows:

signal i: integer;
signal R: Real;

...

R <= Real(i);
like image 88
Peter Bennett Avatar answered Sep 17 '22 20:09

Peter Bennett