1/1
12-bit numerically controlled oscillator
by harish1 on Mar 20, 2012 |
harish1
Posts: 6 Joined: Nov 7, 2011 Last seen: Apr 13, 2012 |
||
Please help me to get verilog code for a numerically controlled oscillator
|
RE: 12-bit numerically controlled oscillator
by harish1 on Mar 25, 2012 |
harish1
Posts: 6 Joined: Nov 7, 2011 Last seen: Apr 13, 2012 |
||
waiting for some response............
|
RE: 12-bit numerically controlled oscillator
by hellwig on Mar 25, 2012 |
hellwig
Posts: 32 Joined: Dec 30, 2007 Last seen: Nov 3, 2024 |
||
Nobody can help you with such an incompletely specified task, sorry. Three lines of Verilog code would do the trick: add a constant to a register, every time the next sample is needed. The register represents the phase, the constant determines the frequency. But I doubt that this would solve your problem. At the very least I would expect that you have to do a table lookup to map the phase into the amplitude of, e.g. a sine wave. The details however depend completely on what you are trying to accomplish.
|
RE: 12-bit numerically controlled oscillator
by harish1 on Mar 25, 2012 |
harish1
Posts: 6 Joined: Nov 7, 2011 Last seen: Apr 13, 2012 |
||
Thanks for the response...
yes,I am using a sine Look up table to convert phase to amplitude but i have a doubt. As we use the truncated output of phase, what about the error. and what must be the range of constant(i.e frequency) we use to add at each clock? waiting for reply |
RE: 12-bit numerically controlled oscillator
by harish1 on Mar 25, 2012 |
harish1
Posts: 6 Joined: Nov 7, 2011 Last seen: Apr 13, 2012 |
||
what about error due to truncation?
what is the range of frequency we should use? |
RE: 12-bit numerically controlled oscillator
by hellwig on Mar 25, 2012 |
hellwig
Posts: 32 Joined: Dec 30, 2007 Last seen: Nov 3, 2024 |
||
The truncation error can be minimized by either using a larger table, or (better) by linear interpolation: multiply the fractional part of the phase with the difference between two consecutive entries in the sine table and add the result to the sine value you looked up in the table under the integral part of the phase. This is most easily done by storing the differences in a second table.
The table stores one complete cycle of the wave (at least in theory - you can get by with a fourth of a cycle because of symmetries). If the sample rate is fs (and thus the sample period is ts = 1/fs), the number of table entrie is n, and the phase increment per sample period is d, then the total time for one cycle of the wave is tw = (ts * n) / d. From that you get the frequency of the generated wave: fw = 1/tw = d / (ts * n) = (d * fs) / n. The absolute values of course depend on your application. |
RE: 12-bit numerically controlled oscillator
by harish1 on Mar 26, 2012 |
harish1
Posts: 6 Joined: Nov 7, 2011 Last seen: Apr 13, 2012 |
||
In my project I am using a look up table with 16384 entries..
This is too big . How to reduce it? Thank you |
RE: 12-bit numerically controlled oscillator
by harish1 on Mar 26, 2012 |
harish1
Posts: 6 Joined: Nov 7, 2011 Last seen: Apr 13, 2012 |
||
And my table has integer values. How to convert integer to binary AND vice-versa in verilog
Thank you |
RE: 12-bit numerically controlled oscillator
by studleylee on Mar 26, 2012 |
studleylee
Posts: 11 Joined: Dec 7, 2004 Last seen: Mar 11, 2024 |
||
https://www.google.com/search?q=DDS+verilog
|
RE: 12-bit numerically controlled oscillator
by zz_indigo on Mar 26, 2012 |
zz_indigo
Posts: 1 Joined: Nov 9, 2010 Last seen: Oct 27, 2024 |
||
In my project I am using a look up table with 16384 entries..
This is too big . How to reduce it? Thank you If this entries is 0-2*pi you can reduce size to quarter. You need on sin(0) to sin(pi/2) other values you can simple calculated. Other case is: using Cordic algoritm. This algoritm requiere lookup table sin(0) - sin(pi/8) http://en.wikipedia.org/wiki/CORDIC p.s. sorry mi english is terrible |
RE: 12-bit numerically controlled oscillator
by mahesh_kannan on Mar 16, 2015 |
mahesh_kannan
Posts: 1 Joined: Jan 24, 2013 Last seen: Dec 24, 2018 |
||
Please help me to get verilog code for a numerically controlled oscillator
|
RE: 12-bit numerically controlled oscillator
by dgisselq on Mar 16, 2015 |
dgisselq
Posts: 247 Joined: Feb 20, 2015 Last seen: Oct 24, 2024 |
||
See comments above. Such an oscillator is ridiculously easy to implement.
|
RE: 12-bit numerically controlled oscillator
by dgisselq on Mar 17, 2015 |
dgisselq
Posts: 247 Joined: Feb 20, 2015 Last seen: Oct 24, 2024 |
||
Have you considered the open core NCO / Periodic Waveform Generator? |
1/1