Altera_Forum
Honored Contributor
14 years agoGenerate PWM signal
Hello everyone,
I am new in fpga and right now I need to generate PWM signal. I do not understand how the following syntax work in order to generate PWM. 1. module PWM(clk, PWM_in, PWM_out); 2. input clk; 3. input [7:0] PWM_in; 4. output PWM_out; 5. reg [8:0] PWM_accumulator; 6. always @(posedge clk) PWM_accumulator <= PWM_accumulator[7:0] + PWM_in; 7. assign PWM_out = PWM_accumulator[8]; 8. endmodule How could the positive edge signal of 'PWM_accumulator <= PWM_accumulator[7:0] + PWM_in' become PWM signal? What is your suggestion about this syntax? Thank you very much.