decadeCounter.vhd

-- msTimer - Decade Counter

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

entity decadeCounter is
port(    clk,rst,cen:    in    std_logic;
        cycle:            out std_logic;
        count:            inout std_logic_vector(3 downto 0));
end decadeCounter;

architecture Behavioral of decadeCounter is
begin

    process(clk,rst) begin
        if(rst = '1') then
            count <= "0000";
        elsif (clk'event and clk = '1' and cen = '1') then
            if(count < "1001") then
                count <= count + 1;
                cycle <= '0';
            else
                count <= "0000";
                cycle <= '1';
            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.