jdh_1984
Member level 2
Hi
I am trying to use the acos function in the math_real library, but this gives the following error in the quartus 9.1 compiler:
Error (10482): VHDL error at Akselerometer.vhd(29): object "ACOS" is used but not declared
I know floating point numbers and fpga is not a good match, so maybe I should use look up tables instead(what is your opinion)?
My code is as follows:
Library ieee;
USE ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library ieee_proposed;
use ieee_proposed.fixed_pkg.all;
use ieee.math_real.all;
ENTITY Akselerometer IS
PORT(
y : IN sfixed(7 downto -4);--Readed accelerometer value
Clock : IN STD_LOGIC;
alphaEstimated : OUT sfixed(7 downto -4));
END Akselerometer;
ARCHITECTURE Behavior OF Akselerometer IS
SIGNAL bias : sfixed(7 downto -4);
SIGNAL argCosREAL,alphaREAL : REAL;
SIGNAL argCos : sfixed(12 downto -10);
BEGIN
bias<=to_sfixed(1.586,bias);--fixed bias =1.586V
PROCESS--Start processing when a new value enters y-pins
BEGIN
IF (y>=bias)THEN
argCos<=bias/y;
argCosREAL<=to_REAL(argCos);
alphaREAL<=ACOS(argCosREAL);
alphaEstimated<=to_sfixed(alphaREAL,alphaEstimated);
ELSIF (y<bias) THEN
argCos<=y/bias;
argCosREAL<=to_REAL(argCos);
alphaREAL<=ACOS(argCosREAL);
alphaEstimated<=to_sfixed((alphaREAL),alphaEstimated);
END IF;
END PROCESS;
END Behavior;
I am trying to use the acos function in the math_real library, but this gives the following error in the quartus 9.1 compiler:
Error (10482): VHDL error at Akselerometer.vhd(29): object "ACOS" is used but not declared
I know floating point numbers and fpga is not a good match, so maybe I should use look up tables instead(what is your opinion)?
My code is as follows:
Library ieee;
USE ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library ieee_proposed;
use ieee_proposed.fixed_pkg.all;
use ieee.math_real.all;
ENTITY Akselerometer IS
PORT(
y : IN sfixed(7 downto -4);--Readed accelerometer value
Clock : IN STD_LOGIC;
alphaEstimated : OUT sfixed(7 downto -4));
END Akselerometer;
ARCHITECTURE Behavior OF Akselerometer IS
SIGNAL bias : sfixed(7 downto -4);
SIGNAL argCosREAL,alphaREAL : REAL;
SIGNAL argCos : sfixed(12 downto -10);
BEGIN
bias<=to_sfixed(1.586,bias);--fixed bias =1.586V
PROCESS--Start processing when a new value enters y-pins
BEGIN
IF (y>=bias)THEN
argCos<=bias/y;
argCosREAL<=to_REAL(argCos);
alphaREAL<=ACOS(argCosREAL);
alphaEstimated<=to_sfixed(alphaREAL,alphaEstimated);
ELSIF (y<bias) THEN
argCos<=y/bias;
argCosREAL<=to_REAL(argCos);
alphaREAL<=ACOS(argCosREAL);
alphaEstimated<=to_sfixed((alphaREAL),alphaEstimated);
END IF;
END PROCESS;
END Behavior;