+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Full Member level 2
    Points: 2,234, Level: 10

    Join Date
    Apr 2006
    Location
    Hyderabad
    Posts
    127
    Helped
    11 / 11
    Points
    2,234
    Level
    10

    Help me write a code for NCO in Verilog

    can any one help me to write code for NCO (numerical control oscillator in verilog.

    if anyone have the code pls can u send me.

    thanx

    •   Alt26th May 2007, 08:47

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 39,790, Level: 48

    Join Date
    Apr 2002
    Location
    USA
    Posts
    3,944
    Helped
    647 / 647
    Points
    39,790
    Level
    48

    NCO

    An NCO can be quite simple: a delta-phase constant repeatedly added to an accumulator. It generates a sawtooth output value, and requires only a few lines of code.

    Code:
    module top (clk, out);
      input             clk;
      output reg [31:0] out = 0;  // assumes Verilog 2001
    
      always @ (posedge clk)
        out <= out + 170000 * 64'h100000000 / 50000000;  // 170 kHz output, 50 MHz clock
    endmodule
    Do you need anything fancier than that?
    If you need a sinewave output, then you can feed the sawtooth into a sine lookup table.

    Plenty of NCO/DDS info available on the web, such as this page:
    http://www.hit.bme.hu/~papay/sci/DDS/start.htm


    1 members found this post helpful.

  3. #3
    Full Member level 2
    Points: 2,234, Level: 10

    Join Date
    Apr 2006
    Location
    Hyderabad
    Posts
    127
    Helped
    11 / 11
    Points
    2,234
    Level
    10

    Re: NCO

    thank u



    •   Alt26th May 2007, 11:06

      advertising

        
       

  4. #4
    Full Member level 2
    Points: 2,234, Level: 10

    Join Date
    Apr 2006
    Location
    Hyderabad
    Posts
    127
    Helped
    11 / 11
    Points
    2,234
    Level
    10

    Re: NCO

    thanx for ur reply.
    and i want something in this to be clear. in the above what is the 64bit data.

    actually my need is . iam taking samples from ADC and i get modulated data from that and i need to Multiply this NCO output to the ADC output . so in this case how i have to write the code.



  5. #5
    Advanced Member level 5
    Points: 39,790, Level: 48

    Join Date
    Apr 2002
    Location
    USA
    Posts
    3,944
    Helped
    647 / 647
    Points
    39,790
    Level
    48

    NCO

    The value 64'h100000000 equals 2^32, where 32 is the accumulator width, which I chose arbitrarily. I made the value 64 bits wide simply to avoid overflow during the multiplication.

    I think you meant to say "i need to Multiply this NCO output by the ADC output". If that's correct, then it sounds like you intend to use the NCO as a local oscillator feeding into a mixer. If that's true, then you probably don't want to use my example until you have converted its sawtooth output into a sinewave. Check your synthesis software libraries for a sinewave table generator, or create your own module.

    Depending on your overall system architecture and your synthesis software capabilities, you may be able to simply use Verilog's * multiply operator to mix the NCO and ADC outputs.



  6. #6
    Full Member level 2
    Points: 2,234, Level: 10

    Join Date
    Apr 2006
    Location
    Hyderabad
    Posts
    127
    Helped
    11 / 11
    Points
    2,234
    Level
    10

    Re: NCO

    in nco how do u take the frequency, and can u tell me how to design frequency syntehsizer,
    i have to track the frequency that is obtained from adc. (this is part of a demodulation technique)



  7. #7
    Full Member level 2
    Points: 2,234, Level: 10

    Join Date
    Apr 2006
    Location
    Hyderabad
    Posts
    127
    Helped
    11 / 11
    Points
    2,234
    Level
    10

    Re: NCO

    track means. carrier tracking. as the signal i obtained is a modulated one so i have to remove the carrier then process actual signal
    no confusion mine is a basic demodulation technique. i want to do the demodulation.



+ Post New Thread
Please login