OpenCores
no use no use 1/1 no use no use
SINE WAVE GENERATION
by keerthna on Dec 11, 2014
keerthna
Posts: 5
Joined: Nov 13, 2014
Last seen: Dec 30, 2014
HOW DO I GENERATE SINE WAVES IN VERILOG? LUT approach is too confusing and vague. can anyone please explain detail about the same. thanks in advance :)
RE: SINE WAVE GENERATION
by tomburkeii on Dec 11, 2014
tomburkeii
Posts: 5
Joined: Feb 17, 2013
Last seen: Aug 23, 2023
well... You can do a lookup table easily enough, and I can provide some code for doing that (I think), as I've done just that.

If you're a glutton for punishment, I've also implemented a sine wave generator using my fixed point math library by computing a 5th (7th?) order Taylor expansion (I was bored, okay?). It works, but it takes a pretty hefty chunk of blocks.
RE: SINE WAVE GENERATION
by aikijw on Dec 11, 2014
aikijw
Posts: 76
Joined: Oct 21, 2011
Last seen: Jul 8, 2023
HOW DO I GENERATE SINE WAVES IN VERILOG? LUT approach is too confusing and vague. can anyone please explain detail about the same. thanks in advance :)


Here you go...

http://en.wikipedia.org/wiki/CORDIC

:-)

/jw
RE: SINE WAVE GENERATION
by jehangir on Dec 11, 2014
jehangir
Posts: 1
Joined: Mar 15, 2012
Last seen: Mar 7, 2017
One way would be to use a DDS (direct digital synthesizer), just look it up, it's quite simple to implement. I implemented it in VHDL for one of my clients. You can, not only generate sine waves with any frequency and phase, but also any other waveform. The idea is quite simple, you just store the samples from one cycle of the wave (or even, for periodic waves, there are ways to store only 1/4th of the period to save memory) and then you cycle through the rom addresses to read out the samples continuously. At the end address you wrap back to the beginning. For increasing the frequency you skip some addresses e.g. for doubling the frequency you skip every other address and so on. For generating the samples, you may use matlab or any other means you feel comfortable with.

Hope that helps.

Jehangir Khan
RE: SINE WAVE GENERATION
by dk4xp on Dec 11, 2014
dk4xp
Posts: 1
Joined: Jun 26, 2008
Last seen: Dec 7, 2024
There is a working solution already here on OpenCores
in http://opencores.org/project,sincos

regards, Gerhard


BTW The OpenCores site could need a clean up. What has a bitcoin miner
or a capacitance meter lost under arithmetic modules?

And writing here an url between angled braces messes the line up.
The idea is that angled braces protect a piece of text against
CRLF insertion & such.
RE: SINE WAVE GENERATION
by keerthna on Dec 12, 2014
keerthna
Posts: 5
Joined: Nov 13, 2014
Last seen: Dec 30, 2014
What values do i have to store in the lut and how? can anyone please provide a sample code or a snippet just to get an idea of the same. thanks in advance
RE: SINE WAVE GENERATION
by keerthna on Dec 12, 2014
keerthna
Posts: 5
Joined: Nov 13, 2014
Last seen: Dec 30, 2014
HOW DO I GENERATE SINE WAVES IN VERILOG? LUT approach is too confusing and vague. can anyone please explain detail about the same. thanks in advance :)


Here you go...

http://en.wikipedia.org/wiki/CORDIC

:-)

/jw

I read about CORDIC but i feel lut approach is easier. Can you explain me?
RE: SINE WAVE GENERATION
by keerthna on Dec 12, 2014
keerthna
Posts: 5
Joined: Nov 13, 2014
Last seen: Dec 30, 2014
well... You can do a lookup table easily enough, and I can provide some code for doing that (I think), as I've done just that.

If you're a glutton for punishment, I've also implemented a sine wave generator using my fixed point math library by computing a 5th (7th?) order Taylor expansion (I was bored, okay?). It works, but it takes a pretty hefty chunk of blocks.


I am trying to use a look up table only. Could you please provide me with your code or sample of the code just to get an idea. Thanks in advance :)
RE: SINE WAVE GENERATION
by keerthna on Dec 30, 2014
keerthna
Posts: 5
Joined: Nov 13, 2014
Last seen: Dec 30, 2014
There is a working solution already here on OpenCores
in http://opencores.org/project,sincos

regards, Gerhard


I am unable to download the file. Even when i unzip it is in some format which my computer doesnt recognize. can anyone helpme out with this
no use no use 1/1 no use no use
© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.