【正文】
wnto 0)。 keyr : out std_logic_vector(15 downto 0)。 end zjh。 signal Disp_Decode : std_logic_vector(7 downto 0)。 signal MIN1,MIN10 : integer range 0 to 9。 signal Year1,Year10 : integer range 0 to 9。 signal Day1,Day10 : integer range 0 to 9。 signal Clk_Count1 : std_logic_vector(13 downto 0)。 signal led_count : std_logic_vector(2 downto 0)。 signal cdount : std_logic_vector(3 downto 0)。 signal s : std_logic_vector(3 downto 0)。 begin process(Clk) begin if(Clk39。139。 else Clk_Count1=00000000000001。 end if。 Clk1Hz=Clk_Count1(13)。039。 SEC10=0。 MIN10=0。 HOUR10=0。 Year1 = 3。 Month1 = 1。 Day1 = 1。event and Clk1Hz=39。) then 正常運(yùn)行 if (K1= 39。) then if(S3=39。) then 調(diào)節(jié)年 if(Year1=9) then Year1=0。 elsif(Year10=9 and Year1=9) then Year1=0。 else Year1=Year1+1。 end if。039。 Month10=Month10+1。 Month10=0。 else Month1=Month1+1。 end if。039。 Day10=Day10+1。 Day10=0。 else Day1=Day1+1。 end if。039。039。 HOUR10=HOUR10+1。 HOUR10=0。 else HOUR1=HOUR1+1。 elsif(S2=39。) then 調(diào)節(jié)分鐘 if(MIN1=9) then MIN1=0。 HOUR1=HOUR1+1。 end if。 end if。 end if。 if(SEC10=5) then SEC10=0。 if(MIN10=5) then MIN10=0。 HOUR1 = 0。 if (Day10 = 3 and Day1 = 0) then Day10 = 0。 Month += 1。 Month1 = 1。 if (Year10 = 9 and Year1 = 9) then Year10 = 0。 end if。 elsif (Year1 = 9) then Year10 = Year10 + 1。 end if。 if (Month1 9) then Month1 = Month1 + 1。 Month1 = 0。 end if。 elsif (Day1 = 9) then Day10 = Day10 + 1。 end if。 elsif (HOUR1 = 9) then HOUR1 = 0。 end if。 end if。 end if。 end if。 end if。 end process。event and Clk=39。) then Music_Count=Music_Count+1。 嘀 else SPK=39。 end if。 嗒 else SPK=39。 end if。 end process。event and Clk1hz=39。) then if(MIN10=5 and MIN1=9 and SEC10=5 and SEC14) then 在59分55秒開始提示 led_Count=led_Count+1。 end if。 end process。 when 001=led_display=1001。 when 011=led_display=1010。 when 101=led_display=1111。 end case。 end process。139。 when 001=Disp_Temp=Year1。 when 011=Disp_Temp=Month10。 when 101=Disp_Temp=10。 when 111=Disp_Temp=Day1。 elsif (K1 = 39。) then case (SEG_SEL+1) is when 000=Disp_Temp=HOUR10。 when 010=Disp_Temp=10。 when 100=Disp_Temp=MIN1。 when 110=Disp_Temp=SEC10。 end case。 end process。event and Clk=39。) then 掃描累加 SEG_SEL=SEG_SEL+1。 end if。 process(Disp_Temp) 顯示轉(zhuǎn)換 begin case Disp_Temp is when 0=Disp_Decode=00111111。 1 when 2=Disp_Decode=01011011。 3 when 4=Disp_Decode=01100110。 5 when 6=Disp_Decode=01111101。 7 when 8=Disp_Decode=01111111。 9 when 10=Disp_Decode=01000000。 全滅 end case。 process(clk) 顯示時(shí)序控制 begin if clk39。139。 if dount=8191 then dount=0000000000000。 else s=S+1。 s=s+1。 end if。 else cdount=0000。 end if。 end process。 d=Day10*10+Day1。 if s=0000 then case cdount is when 0000=keyr=1111111111111111。 when 0010=keyr=1101011111101111。 when 0100=keyr=1101110111110111。 when 0110=keyr=1101111100011111。 when 1000=keyr=1111111111111111。 when 1010=keyr=1110111111101111。 when 1100=keyr=1101111111110111。 when 1110=keyr=1110111111101111。 when others=keyr=1111111111111111。elsif s=0001 thencase y is when 13= case cdount is when 0000=keyr=1111111111111111。 when 0010=keyr=1111111111001111。 when 0100=keyr=1111111111111111。 when 0110=keyr=1111111111111111。 when 1000=keyr=1111111111111111。 when 1010=keyr=1101111111110111。 when 1100=keyr=1101111011110111。 when 1110=keyr=1110000100001111。 when others=keyr=1111111111111111。 when 14= case cdount is when 0000=keyr=1111111111111111。 when 0010=keyr=1111111111001111。 when 0100=keyr=1111111111111111。 when 0110=keyr=1111111111111111。 when 1000=keyr=1111111111111111。 when 1010=keyr=1111101011111111。 when 1100=keyr=1111101111011111。