diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2018-06-19 16:10:42 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2018-06-19 16:10:42 +0200 |
commit | 35c2a01ff8831dabcd06c00999a3f66e494ced22 (patch) | |
tree | d3ea5b447fcc9989d90c5f1db63b16d1b25c58fa /src | |
parent | 478179fd21ec7147208f071260b887e866b3a5c9 (diff) |
Minor cleanup.
Diffstat (limited to 'src')
-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 |