From 35c2a01ff8831dabcd06c00999a3f66e494ced22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 19 Jun 2018 16:10:42 +0200 Subject: Minor cleanup. --- src/rtl/toggle.v | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rtl/toggle.v b/src/rtl/toggle.v index 548b85e..31c4518 100644 --- a/src/rtl/toggle.v +++ b/src/rtl/toggle.v @@ -51,6 +51,7 @@ module toggle reg [7 : 0] toggle_ctr_new; reg toggle_reg; + reg toggle_new; reg toggle_we; assign gpio_b = {7'b1010101, toggle_reg}; @@ -67,22 +68,22 @@ module toggle toggle_ctr_reg <= toggle_ctr_new; if (toggle_we) - toggle_reg <= ~toggle_reg; + toggle_reg <= toggle_new; end end always @* begin : sys_clk_toggle + toggle_new = ~toggle_reg; + toggle_we = 1'b0; + if (toggle_ctr_reg == TOGGLE_DELAY_CYCLES) begin toggle_ctr_new = 32'h0; toggle_we = 1'b1; end else - begin - toggle_ctr_new = toggle_ctr_reg + 1'b1; - toggle_we = 1'b0; - end + toggle_ctr_new = toggle_ctr_reg + 1'b1; end endmodule // toggle -- cgit v1.2.3