Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20822 Discussions

Implimenting a NCO Core.

Altera_Forum
Honored Contributor II
2,922 Views

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 you
0 Kudos
23 Replies
Altera_Forum
Honored Contributor II
1,229 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,228 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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....
0 Kudos
Altera_Forum
Honored Contributor II
1,228 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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!
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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!
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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!!
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Yes, I have the license to use Quartus. There is no "limited..sof". 

I think there is a special license you have to get to use a fully functional NCO.
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Check the License Setup menu to see if you have the NCO Feature on your license 

It should appear as Numerically Controlled Oscillator. 

But even if you don't have the license, you can evaluate the core using the JTAG. 

I think there might be something else interfering on your project. 

How are you checking if the NCO is working? Did you use signal tap?
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Hello Thiago! 

 

I tried with the new Quartus v8.1 and now it works fine. I get a time limited .sof.  

Thank you very much!!
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Hello Friends! 

 

I trying to do a simulation with the NCO mega function and I have been unable, I have tried to follow the steps outlined here, but for some reason I do not work well simulation :confused:, my goal is to generate a sine wave of 50 Hz, I would like to compare with two triangular waves...but what interests me is the first generate the sinusoidal and be able to view...attached a screenshot of the schematic of what I have, be attentive to any suggestions. 

 

Regards 

 

Edgardo
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Hello. 

 

...try to set the "reset_n" to "VCC" ! 

 

Tobias
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Heh, exactly! 

=]
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Thanks for your answers! 

 

Even I could not visualize the waveforms, so I doubt emerged another. I need be made of pins configured to be able to simulate?, The simulation also takes a long time to run. 

Maybe I need to adjust some parameters of simulation, but follow the steps for doing the video tutorial. 

 

Regards 

 

Edgardo 

 

P.S.: sorry for the drafting, what happens is that I'm using a translator to write.
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

I'm sorry Edgardo, I don't quite understand what you are saying 

Could you please try to explain it better?  

In portuguese perhaps? Spanish? :) 

 

Regards 

Thiago
0 Kudos
Altera_Forum
Honored Contributor II
1,229 Views

Hola Thiago 

 

Hablas español?...no se si pueda hablar en español en este foro, pero ya lo hice, jaja 

 

Lo que mecionaba es que aun no puedo visualizar las formas de onda, a lo que me surge otra duda, es necesario tener configurados los pines de salida en el chip correspondiente para tener una correcta simulación?, porque he seguido los pasos dados en el video tutorial, pero omití el paso del pin planner. 

 

Saludos
0 Kudos
Altera_Forum
Honored Contributor II
1,110 Views

What are the results of your simulation? Nothing at all? 

It isn't necessary to map the device pins just to make the simulation work. 

Have you configured the clock input pin in your simulation to provide a clock to the pll? 

You need to create a waveform file and put the clock input in it, and attribute a clock to this pin so that it can drive your pll. 

 

I hope this helps 

 

Regards, 

Thiago
0 Kudos
Reply