library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity cnt60 is
port (
reset, en, clk : in std_logic;
ca : out std_logic;
q : out std_logic_vector (7 downto 0)
);
end cnt60;
architecture rtl of cnt60 is
signal ca_tmp_s: std_logic;
begin
process (clk, reset)
variable q60: integer;
begin
if (reset='1') then
q60 := 0;
ca_tmp_s <= '0';
elsif (clk'event and clk='1') then
if (en='1') then
if (q60=59) then
q60 := 0;
ca_tmp_s <= '1';
else
q60 := q60 + 1;
ca_tmp_s <= '0';
end if;
end if;
end if;
q <= conv_std_logic_vector (q60, 8);
end process;
process (ca_tmp_s, en)
begin
ca <= ca_tmp_s and en;
end process;
end rtl;