Created
January 7, 2019 07:14
-
-
Save kbob/8c5f1089c75693db819bf6ca81c63884 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`default_nettype none | |
module blinky (CLK, LED1); | |
input wire CLK; | |
output wire LED1; | |
parameter WIDTH = 24; | |
parameter CLK_HZ = 12_000_000; | |
reg [WIDTH-1:0] counter; | |
reg [7:0] led1; | |
wire [WIDTH-1:0] wrap = (CLK_HZ >> 8) - 1; | |
always @(posedge CLK) | |
if (counter == wrap) begin | |
counter <= 0; | |
led1 <= led1 + 1; | |
end | |
else | |
counter <= counter + 1; | |
assign LED1 = led1 * led1 > counter[15:0]; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment