-------------------------------------------时间设置小时部分
sethour1:process(clk,seth2)
begin
if clk'event and clk='1' then
if seth1="0010"and seth2="0011" then
seth1<="0000";
elsif seth2="1001" then
seth1<=seth1+1;
end if;
end if;
end process sethour1;
-------------------------------------------
sethour2:process(clk,md1,md2,seth1)
begin
if clk'event and clk='1' then
if (seth1="0010"and seth2="0011")or seth2="1001"then
seth2<="0000";
elsif md1='1' and md2="00" then
seth2<=seth2+1;
end if;
end if;
end process sethour2;
-------------------------------------------时间设置分钟部分
setmin1:process(clk,setm2)
begin
if clk'event and clk='1' then
if setm1="0101"and setm2="1001"then
setm1<="0000";
elsif setm2="1001"then
setm1<=setm1+1;
end if;
end if;
end process setmin1;
----------------------------------------------
setmin2:process(clk,md1,md2)
begin
if clk'event and clk='1'then
if setm2="1001"then
setm2<="0000";
elsif md1='1' and md2="01"then
setm2<=setm2+1;
end if;
end if;
end process setmin2;
--------------------------------------------
--------------------------------------------闹铃
speaker:process(clk1,hou1,hou2,min1,min2)
begin
if clk1'event and clk1='1'then
if seth1=hou1 and seth2=hou2 and setm1=min1 and setm2=min2 then
speak<=clk1;
else speak<='0';
end if;
end if;
end process speaker;
代码太长没发完
温馨提示:答案为网友推荐,仅供参考