Sine Wave Generation

Feb 11, 2004 8 Replies

Hi all



I need some help with regards to generating a sine wave. I thought abt this problem and some thoughts that came to mind are as follows:



  1. Generate sine values using spreadsheet
  2. Store these values either in ROM or make a table withing VHDL
  3. Write VHDL code and output these values.

My question is: Is it better to store these values in ROM (eg. LUT) or directly hardcode the values. Is there a website that will explain or give more explanation in this area.



Cheers


--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

If you need more than a few points, a ROM would be a better idea. I did this to generate a sine wave (via a D/A) for an all digital LVDT synchronous demodulation circuit. The beauty of using ROM is you can store many points, including multiple frequencies by using the upper address lines to select a different set of values.

BTW, I used C and/or Visual Basic to generate the values, writing them directly to a binary file, then using the file to program the ROM.

-- Greg snipped-for-privacy@hotmail.com.invalid (Remove the '.invalid' twice to send Email)

this

the

area.

You could use a single digital output to produce a square wave at the fundamental frequency, then filter out the harmonics to produce a sinewave.

It wouldn't be the most flexible soluti> Depends on the number of phase angles you need to have. For example, if you

1,0,

may

Andrew Greensted Department of Electronics Bio-Inspired Engineering University of York, UK Tel: +44(0)1904 432379 Mailto: ajg112@ohm.york.ac.uk Fax: +44(0)1904 433224 Web: www.bioinspired.com

There is a synthesisable sine wave generator on our website here :

formatting link

It includes a perl script to generate a sine wave lookup table of arbitrary dimensions/precision. The code will probably want modifying slightly so it uses LUT based ROM or BRAMs. If I have time, I might add an FPGA optimisd version...

HTH

Ian

-- Ian Poole, Consultant

The contents of this message may contain personal views which are not the views of Doulos Ltd., unless specifically stated.

this

the

area.

--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

(big snip)

I seem to remember ones that had two ROMs, where the second was a linear interpolation. Adders were then used to combine the results from the ROMs. There may be some FPGA cases where that method could still be used.

-- glen

1) write a sample counter. when the msb of the counter is '0', take all lsb. when the msb of the counter is '1', invert all lsb. The result is a triangular wawe. 2) Cut the top and bottom of your triangular wawe using comparators

3) used a filter to remove harmonics

Laurent Gauch

formatting link

There's a fairly nice arbitrary frequency sine and cosine generator core available from Xilinx that has a whole host of options. We're playing with it on a current project. It even has a multiplex mode where you can reuse the LUTs for up to 16 different signals.

YMMV

-Marty

arbitrary

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required