Forum Discussion
4 Replies
- Altera_Forum
Honored Contributor
The code is simply doing nothing, because the output pwm isn't set anywhere in the code. Synthesizes to nothing (0 LEs).
A complete pwm unit would have a duty cycle input. if (counter<=256) should be changed to if (counter >= 255) for reasonable counter operation.module pwm1(clk,pwm); input clk; output pwm; reg counter=0; reg pwm; always @(posedge clk) begin counter=counter+1; If (counter<=256) counter=0; end endmodule - Altera_Forum
Honored Contributor
sorry sir , I don't mean about pwm generation. I want to know why error occurring during compilation of attached code.
this time I attached another code. please check why error coming during compilation. - Altera_Forum
Honored Contributor
Verilog is case sensitive, if isn't a legal keyword.
Please consider also that (counter>=256) never happens, because the maximum value of counter is 255. - Altera_Forum
Honored Contributor
Thank you sir