LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
EN
tiTY addcnt60 IS
PORT(clk,reset,load:IN STD_LOGIC;
dh,dl:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
co:OUT STD_LOGIC;
qh,ql:BUFFER STD_LOGIC_VECTOR(3 DOWNTO 0));
END addcnt60;
ARCHITECTURE behave OF addcnt20 IS
BEGIN
PROCESS(clk)
BEGIN
IF reset='1' THEN
ql<="0000";qh<="0000"; co<='0';
ELSIF load='1' THEN
ql<=dl;qh<=dh;
ELSIF(clk'event and clk='1' )THEN
IF(qh=5 and ql=9)THEN
ql<="0000";qh<="0000";co<='1';
ELSIF(ql=9)THEN
ql<="0000"; qh<=qh+1;
ELSE ql<=ql+1;co<='0';
END IF;
END IF;
END PROCESS;
END behave;
一周热门 更多>