diff options
author | David Phillips <david@yeah.nah.nz> | 2021-10-25 14:54:57 +1300 |
---|---|---|
committer | David Phillips <david@yeah.nah.nz> | 2021-10-25 21:03:32 +1300 |
commit | e7a3f6377c18b346f455f5f7e5ad2a73d0a032f7 (patch) | |
tree | f9fc1134c9ef7ab3519f9dcff1420c6b5d67309c /blink.v | |
download | colorlight-5a-75e-blinky-e7a3f6377c18b346f455f5f7e5ad2a73d0a032f7.tar.xz |
Initial commit
Diffstat (limited to 'blink.v')
-rw-r--r-- | blink.v | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +module blink( + input rst_i, + input clk_i, + output reg led_o +); + +parameter COUNTER_WIDTH = 32; +parameter OVERFLOW = 25_000_000; + +reg[COUNTER_WIDTH-1:0] counter; + +always @(posedge clk_i) begin + if (rst_i) begin + counter <= 0; + led <= 1; + end else if (counter == OVERFLOW-1) begin + led_o <= ~led_o; + counter <= 0; + end else + counter <= counter + 1; +end + +endmodule |