-- sine_LUT.vhd

-- This code creates a sine wave samples LUT. 

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;

entity sine_lut is
  port(clock, reset_n, rd_enable : in std_logic;
       table_index : in std_logic_vector(7 downto 0);
       table_value : out std_logic_vector (7 downto 0));
end sine_lut;
     
architecture sine_lut_arch of sine_lut is 
begin

process (clock,reset_n) 
begin
  
if(reset_n = '0') then
table_value <= (others => '0');
elsif(clock'event and clock = '1') then
   if(rd_enable = '1') then
   case (conv_integer(table_index)) is     
    when 0 => table_value <= conv_std_logic_vector(128,8);
	when 1 => table_value <= conv_std_logic_vector(131,8);
	when 2 => table_value <= conv_std_logic_vector(134,8);
	when 3 => table_value <= conv_std_logic_vector(137,8);
	when 4 => table_value <= conv_std_logic_vector(140,8);
	when 5 => table_value <= conv_std_logic_vector(143,8);
	when 6 => table_value <= conv_std_logic_vector(146,8);
	when 7 => table_value <= conv_std_logic_vector(149,8);
	when 8 => table_value <= conv_std_logic_vector(153,8);
	when 9 => table_value <= conv_std_logic_vector(156,8);
	when 10 => table_value <= conv_std_logic_vector(159,8);
	when 11 => table_value <= conv_std_logic_vector(162,8);
	when 12 => table_value <= conv_std_logic_vector(165,8);
	when 13 => table_value <= conv_std_logic_vector(168,8);
	when 14 => table_value <= conv_std_logic_vector(171,8);
	when 15 => table_value <= conv_std_logic_vector(174,8);
	when 16 => table_value <= conv_std_logic_vector(177,8);
	when 17 => table_value <= conv_std_logic_vector(180,8);
	when 18 => table_value <= conv_std_logic_vector(182,8);
	when 19 => table_value <= conv_std_logic_vector(185,8);
	when 20 => table_value <= conv_std_logic_vector(188,8);
	when 21 => table_value <= conv_std_logic_vector(191,8);
	when 22 => table_value <= conv_std_logic_vector(194,8);
	when 23 => table_value <= conv_std_logic_vector(196,8);
	when 24 => table_value <= conv_std_logic_vector(199,8);
	when 25 => table_value <= conv_std_logic_vector(201,8);
	when 26 => table_value <= conv_std_logic_vector(204,8);
	when 27 => table_value <= conv_std_logic_vector(206,8);
	when 28 => table_value <= conv_std_logic_vector(209,8);
	when 29 => table_value <= conv_std_logic_vector(211,8);
	when 30 => table_value <= conv_std_logic_vector(214,8);
	when 31 => table_value <= conv_std_logic_vector(216,8);
	when 32 => table_value <= conv_std_logic_vector(218,8);
	when 33 => table_value <= conv_std_logic_vector(220,8);
	when 34 => table_value <= conv_std_logic_vector(223,8);
	when 35 => table_value <= conv_std_logic_vector(225,8);
	when 36 => table_value <= conv_std_logic_vector(227,8);
	when 37 => table_value <= conv_std_logic_vector(229,8);
	when 38 => table_value <= conv_std_logic_vector(231,8);
	when 39 => table_value <= conv_std_logic_vector(232,8);
	when 40 => table_value <= conv_std_logic_vector(234,8);
	when 41 => table_value <= conv_std_logic_vector(236,8);
	when 42 => table_value <= conv_std_logic_vector(238,8);
	when 43 => table_value <= conv_std_logic_vector(239,8);
	when 44 => table_value <= conv_std_logic_vector(241,8);
	when 45 => table_value <= conv_std_logic_vector(242,8);
	when 46 => table_value <= conv_std_logic_vector(243,8);
	when 47 => table_value <= conv_std_logic_vector(245,8);
	when 48 => table_value <= conv_std_logic_vector(246,8);
	when 49 => table_value <= conv_std_logic_vector(247,8);
	when 50 => table_value <= conv_std_logic_vector(248,8);
	when 51 => table_value <= conv_std_logic_vector(249,8);
	when 52 => table_value <= conv_std_logic_vector(250,8);
	when 53 => table_value <= conv_std_logic_vector(251,8);
	when 54 => table_value <= conv_std_logic_vector(252,8);
	when 55 => table_value <= conv_std_logic_vector(253,8);
	when 56 => table_value <= conv_std_logic_vector(253,8);
	when 57 => table_value <= conv_std_logic_vector(254,8);
	when 58 => table_value <= conv_std_logic_vector(254,8);
	when 59 => table_value <= conv_std_logic_vector(255,8);
	when 60 => table_value <= conv_std_logic_vector(255,8);
	when 61 => table_value <= conv_std_logic_vector(255,8);
	when 62 => table_value <= conv_std_logic_vector(255,8);
	when 63 => table_value <= conv_std_logic_vector(255,8);
	when 64 => table_value <= conv_std_logic_vector(255,8);
	when 65 => table_value <= conv_std_logic_vector(255,8);
	when 66 => table_value <= conv_std_logic_vector(255,8);
	when 67 => table_value <= conv_std_logic_vector(255,8);
	when 68 => table_value <= conv_std_logic_vector(255,8);
	when 69 => table_value <= conv_std_logic_vector(254,8);
	when 70 => table_value <= conv_std_logic_vector(254,8);
	when 71 => table_value <= conv_std_logic_vector(253,8);
	when 72 => table_value <= conv_std_logic_vector(253,8);
	when 73 => table_value <= conv_std_logic_vector(252,8);
	when 74 => table_value <= conv_std_logic_vector(251,8);
	when 75 => table_value <= conv_std_logic_vector(251,8);
	when 76 => table_value <= conv_std_logic_vector(250,8);
	when 77 => table_value <= conv_std_logic_vector(249,8);
	when 78 => table_value <= conv_std_logic_vector(248,8);
	when 79 => table_value <= conv_std_logic_vector(247,8);
	when 80 => table_value <= conv_std_logic_vector(245,8);
	when 81 => table_value <= conv_std_logic_vector(244,8);
	when 82 => table_value <= conv_std_logic_vector(243,8);
	when 83 => table_value <= conv_std_logic_vector(241,8);
	when 84 => table_value <= conv_std_logic_vector(240,8);
	when 85 => table_value <= conv_std_logic_vector(238,8);
	when 86 => table_value <= conv_std_logic_vector(237,8);
	when 87 => table_value <= conv_std_logic_vector(235,8);
	when 88 => table_value <= conv_std_logic_vector(233,8);
	when 89 => table_value <= conv_std_logic_vector(232,8);
	when 90 => table_value <= conv_std_logic_vector(230,8);
	when 91 => table_value <= conv_std_logic_vector(228,8);
	when 92 => table_value <= conv_std_logic_vector(226,8);
	when 93 => table_value <= conv_std_logic_vector(224,8);
	when 94 => table_value <= conv_std_logic_vector(222,8);
	when 95 => table_value <= conv_std_logic_vector(219,8);
	when 96 => table_value <= conv_std_logic_vector(217,8);
	when 97 => table_value <= conv_std_logic_vector(215,8);
	when 98 => table_value <= conv_std_logic_vector(213,8);
	when 99 => table_value <= conv_std_logic_vector(210,8);
	when 100 => table_value <= conv_std_logic_vector(208,8);
	when 101 => table_value <= conv_std_logic_vector(205,8);
	when 102 => table_value <= conv_std_logic_vector(203,8);
	when 103 => table_value <= conv_std_logic_vector(200,8);
	when 104 => table_value <= conv_std_logic_vector(198,8);
	when 105 => table_value <= conv_std_logic_vector(195,8);
	when 106 => table_value <= conv_std_logic_vector(192,8);
	when 107 => table_value <= conv_std_logic_vector(190,8);
	when 108 => table_value <= conv_std_logic_vector(187,8);
	when 109 => table_value <= conv_std_logic_vector(184,8);
	when 110 => table_value <= conv_std_logic_vector(181,8);
	when 111 => table_value <= conv_std_logic_vector(178,8);
	when 112 => table_value <= conv_std_logic_vector(175,8);
	when 113 => table_value <= conv_std_logic_vector(172,8);
	when 114 => table_value <= conv_std_logic_vector(169,8);
	when 115 => table_value <= conv_std_logic_vector(166,8);
	when 116 => table_value <= conv_std_logic_vector(163,8);
	when 117 => table_value <= conv_std_logic_vector(160,8);
	when 118 => table_value <= conv_std_logic_vector(157,8);
	when 119 => table_value <= conv_std_logic_vector(154,8);
	when 120 => table_value <= conv_std_logic_vector(151,8);
	when 121 => table_value <= conv_std_logic_vector(148,8);
	when 122 => table_value <= conv_std_logic_vector(145,8);
	when 123 => table_value <= conv_std_logic_vector(142,8);
	when 124 => table_value <= conv_std_logic_vector(139,8);
	when 125 => table_value <= conv_std_logic_vector(136,8);
	when 126 => table_value <= conv_std_logic_vector(132,8);
	when 127 => table_value <= conv_std_logic_vector(129,8);
	when 128 => table_value <= conv_std_logic_vector(126,8);
	when 129 => table_value <= conv_std_logic_vector(123,8);
	when 130 => table_value <= conv_std_logic_vector(120,8);
	when 131 => table_value <= conv_std_logic_vector(117,8);
	when 132 => table_value <= conv_std_logic_vector(114,8);
	when 133 => table_value <= conv_std_logic_vector(110,8);
	when 134 => table_value <= conv_std_logic_vector(107,8);
	when 135 => table_value <= conv_std_logic_vector(104,8);
	when 136 => table_value <= conv_std_logic_vector(101,8);
	when 137 => table_value <= conv_std_logic_vector(98,8);
	when 138 => table_value <= conv_std_logic_vector(95,8);
	when 139 => table_value <= conv_std_logic_vector(92,8);
	when 140 => table_value <= conv_std_logic_vector(89,8);
	when 141 => table_value <= conv_std_logic_vector(86,8);
	when 142 => table_value <= conv_std_logic_vector(83,8);
	when 143 => table_value <= conv_std_logic_vector(80,8);
	when 144 => table_value <= conv_std_logic_vector(77,8);
	when 145 => table_value <= conv_std_logic_vector(74,8);
	when 146 => table_value <= conv_std_logic_vector(71,8);
	when 147 => table_value <= conv_std_logic_vector(69,8);
	when 148 => table_value <= conv_std_logic_vector(66,8);
	when 149 => table_value <= conv_std_logic_vector(63,8);
	when 150 => table_value <= conv_std_logic_vector(60,8);
	when 151 => table_value <= conv_std_logic_vector(58,8);
	when 152 => table_value <= conv_std_logic_vector(55,8);
	when 153 => table_value <= conv_std_logic_vector(52,8);
	when 154 => table_value <= conv_std_logic_vector(50,8);
	when 155 => table_value <= conv_std_logic_vector(47,8);
	when 156 => table_value <= conv_std_logic_vector(45,8);
	when 157 => table_value <= conv_std_logic_vector(43,8);
	when 158 => table_value <= conv_std_logic_vector(40,8);
	when 159 => table_value <= conv_std_logic_vector(38,8);
	when 160 => table_value <= conv_std_logic_vector(36,8);
	when 161 => table_value <= conv_std_logic_vector(34,8);
	when 162 => table_value <= conv_std_logic_vector(32,8);
	when 163 => table_value <= conv_std_logic_vector(29,8);
	when 164 => table_value <= conv_std_logic_vector(27,8);
	when 165 => table_value <= conv_std_logic_vector(26,8);
	when 166 => table_value <= conv_std_logic_vector(24,8);
	when 167 => table_value <= conv_std_logic_vector(22,8);
	when 168 => table_value <= conv_std_logic_vector(20,8);
	when 169 => table_value <= conv_std_logic_vector(18,8);
	when 170 => table_value <= conv_std_logic_vector(17,8);
	when 171 => table_value <= conv_std_logic_vector(15,8);
	when 172 => table_value <= conv_std_logic_vector(14,8);
	when 173 => table_value <= conv_std_logic_vector(12,8);
	when 174 => table_value <= conv_std_logic_vector(11,8);
	when 175 => table_value <= conv_std_logic_vector(10,8);
	when 176 => table_value <= conv_std_logic_vector(9,8);
	when 177 => table_value <= conv_std_logic_vector(7,8);
	when 178 => table_value <= conv_std_logic_vector(6,8);
	when 179 => table_value <= conv_std_logic_vector(5,8);
	when 180 => table_value <= conv_std_logic_vector(4,8);
	when 181 => table_value <= conv_std_logic_vector(4,8);
	when 182 => table_value <= conv_std_logic_vector(3,8);
	when 183 => table_value <= conv_std_logic_vector(2,8);
	when 184 => table_value <= conv_std_logic_vector(2,8);
	when 185 => table_value <= conv_std_logic_vector(1,8);
	when 186 => table_value <= conv_std_logic_vector(1,8);
	when 187 => table_value <= conv_std_logic_vector(0,8);
	when 188 => table_value <= conv_std_logic_vector(0,8);
	when 189 => table_value <= conv_std_logic_vector(0,8);
	when 190 => table_value <= conv_std_logic_vector(0,8);
	when 191 => table_value <= conv_std_logic_vector(0,8);
	when 192 => table_value <= conv_std_logic_vector(0,8);
	when 193 => table_value <= conv_std_logic_vector(0,8);
	when 194 => table_value <= conv_std_logic_vector(0,8);
	when 195 => table_value <= conv_std_logic_vector(0,8);
	when 196 => table_value <= conv_std_logic_vector(0,8);
	when 197 => table_value <= conv_std_logic_vector(1,8);
	when 198 => table_value <= conv_std_logic_vector(1,8);
	when 199 => table_value <= conv_std_logic_vector(2,8);
	when 200 => table_value <= conv_std_logic_vector(2,8);
	when 201 => table_value <= conv_std_logic_vector(3,8);
	when 202 => table_value <= conv_std_logic_vector(4,8);
	when 203 => table_value <= conv_std_logic_vector(5,8);
	when 204 => table_value <= conv_std_logic_vector(6,8);
	when 205 => table_value <= conv_std_logic_vector(7,8);
	when 206 => table_value <= conv_std_logic_vector(8,8);
	when 207 => table_value <= conv_std_logic_vector(9,8);
	when 208 => table_value <= conv_std_logic_vector(10,8);
	when 209 => table_value <= conv_std_logic_vector(11,8);
	when 210 => table_value <= conv_std_logic_vector(13,8);
	when 211 => table_value <= conv_std_logic_vector(14,8);
	when 212 => table_value <= conv_std_logic_vector(16,8);
	when 213 => table_value <= conv_std_logic_vector(17,8);
	when 214 => table_value <= conv_std_logic_vector(19,8);
	when 215 => table_value <= conv_std_logic_vector(21,8);
	when 216 => table_value <= conv_std_logic_vector(22,8);
	when 217 => table_value <= conv_std_logic_vector(24,8);
	when 218 => table_value <= conv_std_logic_vector(26,8);
	when 219 => table_value <= conv_std_logic_vector(28,8);
	when 220 => table_value <= conv_std_logic_vector(30,8);
	when 221 => table_value <= conv_std_logic_vector(32,8);
	when 222 => table_value <= conv_std_logic_vector(34,8);
	when 223 => table_value <= conv_std_logic_vector(36,8);
	when 224 => table_value <= conv_std_logic_vector(39,8);
	when 225 => table_value <= conv_std_logic_vector(41,8);
	when 226 => table_value <= conv_std_logic_vector(43,8);
	when 227 => table_value <= conv_std_logic_vector(46,8);
	when 228 => table_value <= conv_std_logic_vector(48,8);
	when 229 => table_value <= conv_std_logic_vector(51,8);
	when 230 => table_value <= conv_std_logic_vector(53,8);
	when 231 => table_value <= conv_std_logic_vector(56,8);
	when 232 => table_value <= conv_std_logic_vector(58,8);
	when 233 => table_value <= conv_std_logic_vector(61,8);
	when 234 => table_value <= conv_std_logic_vector(64,8);
	when 235 => table_value <= conv_std_logic_vector(67,8);
	when 236 => table_value <= conv_std_logic_vector(69,8);
	when 237 => table_value <= conv_std_logic_vector(72,8);
	when 238 => table_value <= conv_std_logic_vector(75,8);
	when 239 => table_value <= conv_std_logic_vector(78,8);
	when 240 => table_value <= conv_std_logic_vector(81,8);
	when 241 => table_value <= conv_std_logic_vector(84,8);
	when 242 => table_value <= conv_std_logic_vector(87,8);
	when 243 => table_value <= conv_std_logic_vector(90,8);
	when 244 => table_value <= conv_std_logic_vector(93,8);
	when 245 => table_value <= conv_std_logic_vector(96,8);
	when 246 => table_value <= conv_std_logic_vector(99,8);
	when 247 => table_value <= conv_std_logic_vector(102,8);
	when 248 => table_value <= conv_std_logic_vector(105,8);
	when 249 => table_value <= conv_std_logic_vector(108,8);
	when 250 => table_value <= conv_std_logic_vector(111,8);
	when 251 => table_value <= conv_std_logic_vector(115,8);
	when 252 => table_value <= conv_std_logic_vector(118,8);
	when 253 => table_value <= conv_std_logic_vector(121,8);
	when 254 => table_value <= conv_std_logic_vector(124,8);
	when 255 => table_value <= conv_std_logic_vector(127,8);
    when others =>
   end case;
  end if;
end if;
end process;
end sine_lut_arch;





