LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
entity sin_lut90 is
generic(Na : Integer range 4 to 6 := 6;
Nd : Integer := 8);
port(
raddr : in std_logic_vector(Na-1 downto 0);
rdata : out std_logic_vector(Nd-1 downto 0));
end sin_lut90;
architecture a of sin_lut90 is
signal subaddr : Integer range 0 to 2**raddr'length-1;
signal y : Integer range 0 to 2**rdata'length-1;
begin
subaddr <= conv_integer(raddr);
a4d8: if Na = 4 and Nd = 8 generate
process(subaddr)
begin
y <= 0;
case subaddr is
-- This part must be generated again by the
-- C++ program for other values of Na and Nd!
when 0 => y <= 0;
when 1 => y <= 25;
when 2 => y <= 50;
when 3 => y <= 74;
when 4 => y <= 98;
when 5 => y <= 120;
when 6 => y <= 142;
when 7 => y <= 162;
when 8 => y <= 180;
when 9 => y <= 197;
when 10 => y <= 212;
when 11 => y <= 225;
when 12 => y <= 236;
when 13 => y <= 244;
when 14 => y <= 250;
when 15 => y <= 254;
when others => NULL;
end case;
end process;
end generate;
a5d8: if Na = 5 and Nd = 8 generate
process(subaddr)
begin
y <= 0;
case subaddr is
-- This part must be generated again by the
-- C++ program for other values of Na and Nd!
when 0 => y <= 0;
when 1 => y <= 13;
when 2 => y <= 25;
when 3 => y <= 37;
when 4 => y <= 50;
when 5 => y <= 62;
when 6 => y <= 74;
when 7 => y <= 86;
when 8 => y <= 98;
when 9 => y <= 109;
when 10 => y <= 120;
when 11 => y <= 131;
when 12 => y <= 142;
when 13 => y <= 152;
when 14 => y <= 162;
when 15 => y <= 171;
when 16 => y <= 180;
when 17 => y <= 189;
when 18 => y <= 197;
when 19 => y <= 205;
when 20 => y <= 212;
when 21 => y <= 219;
when 22 => y <= 225;
when 23 => y <= 231;
when 24 => y <= 236;
when 25 => y <= 240;
when 26 => y <= 244;
when 27 => y <= 247;
when 28 => y <= 250;
when 29 => y <= 252;
when 30 => y <= 254;
when 31 => y <= 255;
when others => NULL;
end case;
end process;
end generate;
a6d8: if Na = 6 and Nd = 8 generate
process(subaddr)
begin
y <= 0;
case subaddr is
-- This part must be generated again by the
-- C++ program for other values of Na and Nd!
when 0 => y <= 0;
when 1 => y <= 6;
when 2 => y <= 13;
when 3 => y <= 19;
when 4 => y <= 25;
when 5 => y <= 31;
when 6 => y <= 37;
when 7 => y <= 44;
when 8 => y <= 50;
when 9 => y <= 56;
when 10 => y <= 62;
when 11 => y <= 68;
when 12 => y <= 74;
when 13 => y <= 80;
when 14 => y <= 86;
when 15 => y <= 92;
when 16 => y <= 98;
when 17 => y <= 103;
when 18 => y <= 109;
when 19 => y <= 115;
when 20 => y <= 120;
when 21 => y <= 126;
when 22 => y <= 131;
when 23 => y <= 136;
when 24 => y <= 142;
when 25 => y <= 147;
when 26 => y <= 152;
when 27 => y <= 157;
when 28 => y <= 162;
when 29 => y <= 167;
when 30 => y <= 171;
when 31 => y <= 176;
when 32 => y <= 180;
when 33 => y <= 185;
when 34 => y <= 189;
when 35 => y <= 193;
when 36 => y <= 197;
when 37 => y <= 201;
when 38 => y <= 205;
when 39 => y <= 208;
when 40 => y <= 212;
when 41 => y <= 215;
when 42 => y <= 219;
when 43 => y <= 222;
when 44 => y <= 225;
when 45 => y <= 228;
when 46 => y <= 231;
when 47 => y <= 233;
when 48 => y <= 236;
when 49 => y <= 238;
when 50 => y <= 240;
when 51 => y <= 242;
when 52 => y <= 244;
when 53 => y <= 246;
when 54 => y <= 247;
when 55 => y <= 249;
when 56 => y <= 250;
when 57 => y <= 251;
when 58 => y <= 252;
when 59 => y <= 253;
when 60 => y <= 254;
when 61 => y <= 254;
when 62 => y <= 255;
when 63 => y <= 255;
when others => NULL;
end case;
end process;
end generate;
rdata <= conv_std_logic_vector(y, rdata'length);
end;