architecture behav of cnt60 is begin variable cq1,cq2:std_logic_vector(3 downto 0); begin if clk'event and clk='1' then cq1:=cq1+1; if cq1>9 then cq1:="0000"; cq2:=cq2+1; end if; if cq2=6 and cq1=0 then cq1:="0000";cq2:="0000";cout<='1'; else cout<='0'; end if; q1<=cq1;q2<=cq2; end process; end; 所写程序经过仿真的如上图所示。同理分和秒一样都是六十进制只不过是把程序中q1,q2分别改为分的十位,个位而已,有程序生成六十进制模块图。如下 该程序在编写过程中应注意IF语句的结束标志END IF所对应的是那一部分. 2、 同步计时二十四进制加法器的程序如下。其中,cout为输出 端口信号,clk为分频模块产生的时计时信号(时钟信号),q1和q2为时计数中十进制数所对应的高位和低位信号。 library ieee; use ; use ; entity cnt24 is port(clk:in std_logic; q1:out std_logic_vector(3 downto 0); q2:out std_logic_vector(3 downto 0); cout:out std_logic); end cnt24 architecture behav of cnt24 is begin process(clk) variable cq1:std_logic_vector(3 downto 0) ; variable cq2:std_log