1
module PWM_Gen(

input clk,             // Clock input
input [7:0]DUTY_CYCLE, // Input Duty Cycle
output PWM_OUT         // Output PWM
);

reg [7:0]counter_out; // 8-bit counter

always @(posedge clk)   
begin
   if (DUTY_CYCLE > counter_out)
   PWM_OUT = 1;
   else
   PWM_OUT = 0;
end

counter counter_inst (  
    .clk(clk),
    .counter_out(counter_out)
)

endmodule

error is -

Error (10170): Verilog HDL syntax error at PWM_Gen.v(51) near text: "endmodule"; expecting ";".

toolic
  • 57,801
  • 17
  • 75
  • 117
Kunal R
  • 19
  • 2
  • For the compile issue --> Please declare counter_out as wire. Use wire [7:0] counter_out and add a semicolon after in the closing bracket of the counter_inst i.e. /*Previous code*/ .counter_out(counter_out) ) ; //Here add semicolon – Pradyuman Bissa Nov 08 '21 at 04:52

2 Answers2

2

It's a typo. You need a ; after the counter_inst instantiation:

counter counter_inst (   
    .clk(clk),
    .counter_out(counter_out)
);
toolic
  • 57,801
  • 17
  • 75
  • 117
Dario Petrillo
  • 980
  • 7
  • 15
-1

It should be added after the counter_inst instantiation, means ; after the ).