twoBitCounter.vhd

-- msTimer - 2-bit Counter

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity twoBitCounter is
port(    clk,rst:     in     std_logic;
        count:        inout    std_logic_vector(1 downto 0));
end twoBitCounter;

architecture Behavioral of twoBitCounter is
begin

    process(clk,rst) begin
        if(rst = '1') then
            count <= "00";
        elsif(clk'event and clk='1') then
            if(count < "11") then
                count <= count + 1;
            else
                count <= "00";
            end if;
        end if;
    end process;

end Behavioral;

Creative Commons License
Milisecond Precsion Timer by Patrick Kramer is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

<< BACK

  1. No comments yet.

  1. No trackbacks yet.