diff --git a/library/common/util_pulse_gen.v b/library/common/util_pulse_gen.v index 5e55ea0cf..d89986b83 100644 --- a/library/common/util_pulse_gen.v +++ b/library/common/util_pulse_gen.v @@ -68,11 +68,11 @@ module util_pulse_gen #( if (rstn == 1'b0) begin pulse_period_cnt <= 32'h0; end else begin - pulse_period_cnt <= (pulse_period_cnt < pulse_period_d) ? (pulse_period_cnt + 1) : 32'b0; + pulse_period_cnt <= (pulse_period_cnt == pulse_period_d) ? 32'b0 : (pulse_period_cnt + 1); end end - assign end_of_period_s = (pulse_period_cnt == (pulse_period_d - 1)) ? 1'b1 : 1'b0; + assign end_of_period_s = (pulse_period_cnt == pulse_period_d) ? 1'b1 : 1'b0; // generate pulse with a specified width