Last active
October 23, 2016 02:14
-
-
Save WakkyFree/5e3b74f08021210349c0a7735cf7206a to your computer and use it in GitHub Desktop.
top module for ZYBO to blink LEDs.
This file contains 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
module zybo_top( | |
input CLK, | |
input RST, | |
output reg [3:0] LED | |
); | |
parameter LED_COUNTER_1SEC = 26'd124999999; | |
reg [25:0] counter_1sec; | |
always @ (posedge CLK) begin | |
if (RST) | |
counter_1sec <= 26'd0; | |
else if (counter_1sec == LED_COUNTER_1SEC) | |
counter_1sec <= 26'd0; | |
else | |
counter_1sec <= counter_1sec + 26'd1; | |
end | |
always @ (posedge CLK) begin | |
if (RST) | |
LED <= 4'b0000; | |
else if (counter_1sec == LED_COUNTER_1SEC) | |
LED <= ~LED; | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment