Created
November 14, 2014 20:52
-
-
Save libertylocked/2822389bab0916a8a88b 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.STD_LOGIC_ARITH.ALL; | |
use IEEE.STD_LOGIC_UNSIGNED.ALL; | |
entity Counter2bit is | |
Port ( Up, CLR : in STD_LOGIC; | |
Q : out STD_LOGIC_VECTOR(1 downto 0)); | |
end Counter2bit; | |
architecture Behavioral of Counter2bit is | |
signal tmp: std_logic_vector(1 downto 0); | |
begin | |
process (Up, CLR) | |
begin | |
if (CLR='1') then | |
tmp <= "00"; | |
elsif (Up'event and Up='1') then | |
tmp <= tmp + 1; | |
end if; | |
end process; | |
Q <= tmp; | |
end Behavioral; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment