Reputation: 185
I'm working with VHDL-2002, trying to declare a constant in the following way
constant CORDIC_SCALE_FACTOR : integer := 0.607252935*(2**COORDS_WIDTH);
With COORDS_WIDTH
being a previously defined generic. However, I'm not being able to perform this multiplication due to types. What I would like to do, is cast 2**COORDS_WIDTH
to a float type, and then cast the result to an integer value (assuming the cast would take the real part of the float and assign it to the integer). How can I accomplish this? I've found resources on the web dealing with this type of conversion but not on literals, this should be easier.
Upvotes: 1
Views: 850
Reputation: 185
Found the solution, it was pretty straightfoward. The 'float' type is named 'real'
constant CORDIC_SCALE_FACTOR : integer := integer(0.607252935*real(2**COORDS_WIDTH));
Upvotes: 1