当前位置:首页 > 基于VHDL的数字闹钟设计
if min2=\(sec1=\and sec2=\ then
min2<=\
elsif min2=\else if (sec1=\and sec2=\or(md1='0' and md2=\min2<=min2+1; end if; end if;end if; end process m220; (2) 时计时器(hour1)
-----------------------------------------------小时十位 h110:process(clk,hou2,min1,min2,sec1,sec2,md1,md2) begin
if clk'event and clk='1' then
if (hou1=\and (sec1=\elsif hou1=\--当时间为23点且处于校时状态时 hou1<=\
elsif (hou2=\
and (sec1=\md2=\
then hou1<=hou1+1; end if; end if;
end process h110;
-----------------------------------------------小时个位 h220:process(clk,min1,min2,sec1,sec2,md1,md2,hou1) begin
if clk'event and clk='1' then
if (hou1=\and (sec1=\
elsif hou2=\and min2=\ and (sec1=\
elsif (hou2=\
13
hou2=\
elsif ((min1=\and min2=\and (sec1=\and sec2=\
or (md1='0' and md2=\end if; end if;
end process h220; (3) 报时模块(speak)
--------------------------------------------闹铃 speaker:process(clk,hou1,hou2,min1,min2) begin
if clk'event and clk='1'then
if seth1=hou1 and seth2=hou2 and setm1=min1 and setm2=min2 then speak<=clk;
else speak<='0'; end if; end if;
end process speaker;
disp:process(md1,hou1,hou2,min1,min2,sec1,sec2,seth1,seth2,setm1,setm2)
begin
if md1='0' then h1<=hou1;h2<=hou2; ---------------计时时间显示和设置模式 m1<=min1;m2<=min2; s1<=sec1;s2<=sec2;
else -----------闹铃时间现实和设置模式 h1<=seth1;h2<=seth2; m1<=setm1;m2<=setm2; s1<=\end if;
end process disp; end one;
14
4.3 仿真及仿真结果分析
(1) 秒时钟仿真
如图4-4,s2满10进1,s1满6进一,即完成60进制秒钟计时。
图4-4 秒时钟仿真
(2) 分时钟仿真
如图4-5,m2满10进1,m1满6进一,即完成60进制分钟计时。
图4-5 分时钟仿真
(3) 报时仿真
为了便于观察,此处定时为18秒,如图4-6speak在18秒结束后被置高。
15
图4-6报时仿真
(4) 功能仿真RTL图
16
共分享92篇相关文档