Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

Where is the PWM core/ip?

Hi all,

I thought there will be a PWM core/ip in Quartus Lite 15.1 (Qsys) but I think I'm wrong. Unless it has a weird name that I can't figure out. Is there one?

Thanks

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    An IP core for a PWM? What is this world coming to? Some functions are so simple that an IP core makes no sense. PWM definitely falls into that category IMO.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    
    module pwmGenerator# (
        parameter CTR_WIDTH = 10 //Width of PWM counter
    )(
        input clock,
        input reset,
        input tick,   //Clock enable - to divide clock frequency as needed
        input  duty,
       
        output reg pwmOut
    );
    localparam ZERO = 0;
    localparam ONE = 1;
    reg  pwmCntr;
    always @ (posedge clock or posedge reset) begin
        if (reset) begin
            pwmCntr <= ZERO;
        end else if (tick) begin
            pwmCntr <= pwmCntr + ONE;
        end
    end
    always @ (posedge clock) begin
       pwmOut <= (pwmCntr < duty);
    end
    

    That took all of 5 minutes to write... - it would have been faster for you to have just written some HDL to do the job than the time you spent searching Quartus for such a simply design and then write this question and wait for answer.
    • ASidd16's avatar
      ASidd16
      Icon for New Contributor rankNew Contributor

      Hello

      I have a Question about PWM Core.

      I understand i can make the PWM working with the above code but how can i control it with the NIOS software and how can i merge it with other interfaces like i want to use all I2C, SPI and interrupts.

      Please reply thank you..