Last active
October 15, 2016 07:11
-
-
Save ScottMansfield/5e5163da4fcebf720d561cdf244d5e94 to your computer and use it in GitHub Desktop.
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
library ieee; | |
use ieee.std_logic_1164.all; | |
use ieee.numeric_std.all; | |
entity blink is | |
port ( | |
clk: in std_logic; | |
buttons: in std_logic_vector(3 downto 0); | |
leds: out std_logic_vector(3 downto 0) | |
); | |
end blink; | |
architecture blink_arch of blink is | |
begin | |
process (clk, buttons) | |
variable btn_inv: std_logic_vector(3 downto 0); | |
variable counter: natural := 0; | |
variable out_temp: std_logic_vector(31 downto 0); | |
begin | |
btn_inv := not buttons; | |
if clk'event and clk = '1' and btn_inv(0) = '1' then | |
counter := counter + 1; | |
end if; | |
out_temp := std_logic_vector(to_unsigned(counter, out_temp'length)); | |
leds <= out_temp(25 downto 22); | |
end process; | |
end blink_arch; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment