Forum Discussion
Altera_Forum
Honored Contributor
17 years agoImplimenting a NCO Core.
Hi i am learning to use Quartus II,
At the moment i am trying to just generate a sin wave for a stratix II board. I have set up the NCO block and got the symbol on the block diagram but i have no idea where to go from here. Can anyone give me the direction to go in or a diagram i can copy from? Thank you23 Replies
- Altera_Forum
Honored Contributor
Hello
You used the megawizard to create the block? So you already set up all the parameters necessary right? If so, all you need is to connect the appropriate signals on the inputs and outputs of the module. The phi_inc input controls the frequency of your sine wave. If you want a fixed frequency just connect this input to a constant. On the megawizard there is a field where you choose the desired output frequency and it gives you the value of the phi_inc (phase increment value parameter). The output frequency is given by the following equation (page 4-4 of the NCO user guide) fo = ( (phi_inc) * fclk ) / 2^M, where M is the accumulator precision and fclk is the clock frequency. clk is the clock input. Connect this to your clock input source. reset_n is the reset ('0' -> reset; '1' -> normal operation). Connect this to your reset control clken is the active high clock enable. fsin_o and fcos_o are the sine and cosine outputs respectively. out_valid is high whenever there is a valid sine or cosine data output. I hope this can help you Regards Thiago - Altera_Forum
Honored Contributor
I discussed some aspects of generating a sine rom in VHDL in a previous thread. If you don't want to use the Altera NCO core for some reason, you can get an idea how to implement a basic NCO from scratch.
[url]http://www.alteraforum.com/forum/showthread.php?t=1902[/rl] I also append a full design example. - Altera_Forum
Honored Contributor
Yea I had no problems setting up the megacore.
My issue was putting in the inputs and outputs, as I found it hard to find any infomation on this. But i found the factory program so i should be able to sort it now as I am starting to understand the inputs and outputs etc i think. No doubt I will be back very soon :P Thank you for the help. - Altera_Forum
Honored Contributor
Hey... I have problems with the NCO too. What do you mean with "just connect this input to a constant" ?? I can only connect the phi_inc input from the NCO-block with input signals.
Furthermore, in the Pin Planner, all my added signals from the Block Diagram, like CLOCK and SINUS_OUT, have the direction "unknown".... Thank you for help.... - Altera_Forum
Honored Contributor
Hello Tobias,
Yes, you need input signals to connect to the NCO phi_inc_in but you could use a vhdl module that produces a constant output and connect it to the NCO. In the pin planner you need to run at least an Analysis and Elaboration before you get the correct input and output pins direction ok? Regards Thiago - Altera_Forum
Honored Contributor
Hello Thiago,
Thank you for your reply. I did the constant with a thing called "lpm_constant"....it's a megafunction symbol. My added signals are still "unknown" after I did the "Analysis and Elaboration". I can set the direction in the Pin Planner after right-click in "Node Properties" as input or output, but they do not automatically. Maybe there is a version/license problem ?? I get no Signal after programming on Cyclone III! - Altera_Forum
Honored Contributor
Hello again.....
Now the signals are set.....but I still get no Signals on Cyclone III. I think the problem is, that the NCO Wizard generates only files for simulating.....not for synthesis. By setting up the NCO with the wizard there is a text that says ".....will create non-functional design". Thanks for your help! - Altera_Forum
Honored Contributor
Hello Tobias!
The Altera NCO Core requires a license to run, do you have one? If not, Quartus should generate a project_name_time_limited.sof If you program this .sof file via JTAG you should be able to evaluate its funcionality. If you disconnect the JTAG programmer the NCO core stops Regards, Thiago - Altera_Forum
Honored Contributor
Hello Thiago!
I am working with Quartus Version 7.2 Build 151 Full Version !! I am not using the NCO Core from the IP MegaStore, but the NCO v7.2 taken from installed Plug_Ins/DSP/Signal Generation/ I am able to program the .sof file via USB JTAG....it is not a "time_limited_one".... Now I will try the new NCO 8.1 from the IP Megastore. Thank you!! - Altera_Forum
Honored Contributor
But do you have the license to use Quartus or are you using the free trial period?
Check your project directory to see if the time limited .sof is there Also check the date and time your sof was created to see if it matches the compilation time