diff options
Diffstat (limited to 'src/rtl')
-rw-r--r-- | src/rtl/toggle.v | 11 |
1 files 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 |