From e16f45c79204327b913ee97bc21a24843acb045b Mon Sep 17 00:00:00 2001 From: Istvan Csomortani Date: Fri, 23 Feb 2018 12:01:37 +0000 Subject: [PATCH] util_pulse_gen: Use equal-to for counter reset --- library/common/util_pulse_gen.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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