Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

VHDL Math Real & Quartus

I've been using the VHDL package ieee.math_real to declare parameters, the idea being to condense as much information in a design file as possible. in particular, for fixed point operations in feedback controls systems, it helps to see the scaling of the parameters directly in the design file. For example, the code below does synthesize correctly in Quartus:

constant RecipSqrt3  :   signed(N-1 downto 0) := to_signed(integer(real(ROUND((2.0**15)*(0.577350269189626)))),16);

However, the code below does not:

variable RecipFactor :   real := ROUND((2.0**15)*(1.0/(SQRT(3.0))));

Quartus gives a message about this; upon further checking the / operator is not defined for A/B where both A and B are real. It is defined, however, for the complex numbers in the complex package of math_real.

I like the notation of 1.0/SQRT(3.0) better than 0.577350269189626 for example.

Has anyone had success with the / operator for complex numbers or real numbers? Thanks in advance. James

11 Replies