【正文】
assert false reportuncertain load_new_alarm control severity warning end if。 end if。 end if。 end process。 end art。 五. 時(shí)間計(jì)數(shù)器 的設(shè)計(jì) : 時(shí)間計(jì)數(shù)器在時(shí)鐘上升沿同步下,根據(jù) load_new_c 端口的輸入控制信號(hào)控制 current_time口的輸出,當(dāng)控制信號(hào)為高電平時(shí),把 new_current_time端口的值賦給 current_time進(jìn)行輸出。當(dāng) reset端口為高電平時(shí),對(duì) current_time端口進(jìn)行清零操作。 Reset 的優(yōu)先級(jí)高于 load_new_c,且當(dāng) reset,load_new_c 同時(shí)為低電平時(shí),在時(shí)鐘上升沿處,對(duì) current_time端口輸出信號(hào)進(jìn)行累加一次加 1,并根據(jù)小時(shí),分鐘 的進(jìn)位規(guī)律進(jìn)位。 Alarm_counter library IEEE。 use 。 use 。 ENTITY Alarm_counter is port(load_new_c:in std_logic。 clk,reset:in std_logic。 new_current_time:in t_clock_time。 current_time:out t_clock_time)。 end Alarm_counter。 ARCHITECTURE art of Alarm_counter is signal i_current_time:t_clock_time。 begin process(clk,reset) variable c_t:t_clock_time。 if reset=39。139。then i_current_time=(0,0,0,0)。 elsif load_new_c=39。139。then i_current_time=new_current_time。 elsif rising_edge(clk)then if c_t(0)=9 then c_t(0):=c_t(0)+1。 else c_t(0):=0。 if c_t(1)6 then c_t(1):=c_t(1)+1。 else c_t(1):=0。 if c_t(3)2 then if c_t(2)=9 then c_t(2):=c_t(2)+1。 else c_t(2):=0。 c_t(3):=c_t(3)+1。 end if。 else c_t(2)3 then c_t(2):=c_t(2)+1。 else c_t(2):=0。 c_t(3):=0。 end if。 end if。 end if。 end if。 i_current_time=c_t。 end if。 end process。 current_time=i_current_time。 end art。 六.鬧鐘系統(tǒng)顯示驅(qū)動(dòng)器 :當(dāng) show_new_time輸入為高電平時(shí),根據(jù) new_time 端口輸入的時(shí)間數(shù)據(jù),產(chǎn)生相應(yīng)的 4 個(gè)七段數(shù)碼顯示器的驅(qū)動(dòng)數(shù)據(jù),并在display 端口輸出該信號(hào);當(dāng) show_new_time 為低電平時(shí),判斷 show_a端口的輸入電平,如果為高電平,則根據(jù) alarm_time端口輸入的時(shí)間數(shù)據(jù),產(chǎn)生相應(yīng)的 4 個(gè)七段數(shù)碼顯示器的驅(qū)動(dòng)數(shù)據(jù),并也在 display端口輸出。若 show_a 也為低電平,根據(jù) current_time 端口的輸入信號(hào),對(duì) display端口驅(qū)動(dòng)。當(dāng) alarm_time 端口的輸入信號(hào)值與current_time端口的輸入信號(hào)值相同時(shí), sound_alarm 端口的輸出信號(hào)有效。反之無(wú)效 Display_driver library IEEE。 use 。 use 。 ENTITY display_driver is port(new_time:in t_clock_time。 current_time:in t_clock_time。 alarm_time:in t_clock_time。 show_new_time:in std_logic。 show_a:in std_logic。 display:out t_display。 sound_alarm:out std_logic)。 end display_driver。 ARCHITECTURE art of display_driver is signal display_time:t_clock_time。 begin process(new_time,alarm_time,current_time,show_new_time,show_a) begin sound_loop:for i in alarm_time39。range loop if(current_time(i)=alarm_time(i))then