Forum Discussion
Altera_Forum
Honored Contributor
14 years ago@ tricky sir,following your susggesion i an trying to do a program,like below
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; USE IEEE.MATH_REAL.ALL; library ieee_proposed; --------use ieee_proposed.numeric_std_additions .all; ---------use ieee_proposed.std_logic_1164_additions.all; use ieee_proposed.fixed_float_types.all; use ieee_proposed.fixed_pkg.all; entity sine_table is Port ( a : in sfixed(3 downto -3); c: out sfixed(0 downto -15)); end sine_table; architecture Behavioral of sine_table is type sin_table_t is array(0 to 1023)of sfixed(0 downto -15); function set_sin_table return sin_table_t is variable ret_table : sin_table_t; begin for i in 0 to 1023 loop ret_table(i) := to_sfixed( (real(i) * MATH_PI) / 1024.0, 0, -15); end loop; return ret_table; end function set_sin_table; --This look up table has 1024 points of sin 0 - PI constant SIN_TABLE : sin_table_t := set_sin_table; begin c <= sin_table(a); end Behavioral; but there occurs an error :Line 61. Wrong index type for sin_table. plz fix the error sir.:cry: