【正文】
b0001_100。 439。b0100:out=739。b1001_111。 reg [6:0] out。 a_0=0。 input op,key,clk,clr。 end end if(!h_1) begin if(add_h_1==439。b0。 add_m_1=0。 assign out=ks|key_1。 end end else begin sign=1。 bcd_l=count[3:0]。 b_m=1。a_1。 reg b_m。 b_h=0。 end always (posedge a or negedge en) if(!en) begin count=data。 wire [7:0] data。 end endalways (posedge clk) begin if(!clr) begin inclk=0。output nclk,inclk。input1key開關(guān)信號(hào)input1out風(fēng)扇工作狀態(tài)信號(hào)output1clk主時(shí)鐘Input1Clr清零信號(hào)Input1A_1Op為1時(shí)a_1為1Output1A_0Op為0時(shí)a_0為1Output1Key_1Key和a_0都為1時(shí)可key_1為1,否則為0。(6)數(shù)據(jù)輸入模塊:當(dāng)賦值信號(hào)(fz)有效后可以通過鍵盤輸入定時(shí)的時(shí)間,確定輸入無誤后按下啟動(dòng)鍵(en),風(fēng)扇開始倒計(jì)時(shí)。1Hz的時(shí)鐘供計(jì)數(shù)模塊的使用。(3)自動(dòng)定時(shí)倒計(jì)時(shí)模塊:選擇定時(shí)模式后,根據(jù)鍵盤的輸入值來設(shè)定工作時(shí)間,在定時(shí)時(shí)間以內(nèi)則風(fēng)扇工作,倒計(jì)時(shí)結(jié)束或開關(guān)關(guān)閉時(shí)風(fēng)扇自動(dòng)關(guān)閉。(3) 定時(shí)模式時(shí),根據(jù)設(shè)定定時(shí)時(shí)間來選擇電風(fēng)扇工作時(shí)間,比如10 分鐘、 20分鐘、 30分鐘等,并且同步顯示剩余工作時(shí)間,但是此時(shí)用戶仍可以通過開關(guān)控制提前關(guān)掉電扇。(4) LED 上顯示當(dāng)前工作狀態(tài):風(fēng)扇工作亮,停止工作滅。 (4)顯示模塊:LED 上顯示當(dāng)前工作狀態(tài):風(fēng)扇工作亮,停止工作滅。2Hz的時(shí)鐘供輸入定時(shí)數(shù)值的使用。 頂層模塊劃分(1)分頻模塊:這個(gè)模塊的功能是把頻率為50MHz的時(shí)鐘轉(zhuǎn)換為1Hz的時(shí)鐘,供計(jì)時(shí)模塊的使用。Output1 電路設(shè)計(jì)(3)自動(dòng)定時(shí)倒計(jì)時(shí)模塊:選擇定時(shí)模式后,根據(jù)鍵盤的輸入值來設(shè)定工作時(shí)間,在定時(shí)時(shí)間以內(nèi)則風(fēng)扇工作,倒計(jì)時(shí)結(jié)束時(shí)風(fēng)扇自動(dòng)關(guān)閉。reg nclk,inclk。 inadd=0。 output b_h。 b_h=0。 end end end always (posedge clk or posedge e) begin if(e) begin bcd_h=count[7:4]。 output [3:0] bcd_h,bcd_l。always (posedge clk) begin if(!en) e=1。 end else begin count[7:4]=count[7:4]1。 end end endmodule module sg(b_m,b_h,clk,sign,clr)。 end end end Endmodule信號(hào)處理模塊module last(key,sign,key_1,out)。 endmodule數(shù)據(jù)輸入模塊module display(h_1,h_0,m_1,m_0,fz,clk,clr,h,m)。 end else begin if(fz) begin if(!m_0) begin if(add_m_0==439。 end