1 function [ y ] = gen_sin_lut( file, length, bits )
2 %gen_sin_lut Generate sinus look-up-table
3 % Generates sinus look-up-table for use in 'wave_table.vhd' entity. One period
4 % is generated. Wave values are in range 0 .. (2^bits - 1).
6 % Length - length of the table
7 % Bits - bit length of each value
8 % File - if not empty waveform is saved in this file for direct use in VHDL
15 y = sin(2*pi*x/length);
16 y = (y + 1) * (2^(bits-1) - 0.5);
21 fprintf(fd,'%s\n',dec2bin(i,bits));