Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Cosine and Sine lookup table in vhdl

Hi i'm new to vhdl and I need a cosine and sine lookup table file in vhdl file already DONE.. because I don't have much time.. please help! thanks.

48 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hm, I have used the "kaz" code, converting DAC_input <= std_logic_vector(sin_data), basically converting signed to SLV and increasing the theta from 0 to 4095. The output is like this: http://i.imgur.com/G4l1d.jpg

    Where did I miss the MSB inversion?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Attached a direct LUT in vhdl

    The input theta_in is the address, you can increment it as you wish to skip samples e.g. increment by 1 to use full table or by 2 to use half table or by 4 to use quarter table and so on.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    no no i did read it.. i think your examples were great but it's just that I'm new and I don't know much about vhdl. I would like to use this code posted by you:

    LIBRARY ieee;

    USE ieee.std_logic_1164.all;

    USE ieee.std_logic_arith.all;

    USE ieee.math_real.all;

    TYPE ROM IS ARRAY(0 TO 511) OF UNSIGNED(8 DOWNTO 0);

    FUNCTION INIT_ROM RETURN ROM IS

    VARIABLE romvar: ROM;

    begin

    --for .. loop

    -- romvar() :=

    --end loop

    return romvar;

    end;

    CONSTANT rom1: ROM := INIT_ROM;

    And from what I understand I have to use some sort of generated values for the for loop. can you please help me, I would really appreciate it.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sounds like you didn't read the link or at least didn't try to understand the code example. In this case, I can't help.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you see the problem is i'm completely new and I don't know how to do that. plus I have quartus-ii web edition.. do you know where I can get and hdl file that's already been done? I just want to implement as soon as possible