2023年VHDL數(shù)字時(shí)鐘實(shí)驗(yàn)報(bào)告_第1頁(yè)
2023年VHDL數(shù)字時(shí)鐘實(shí)驗(yàn)報(bào)告_第2頁(yè)
2023年VHDL數(shù)字時(shí)鐘實(shí)驗(yàn)報(bào)告_第3頁(yè)
2023年VHDL數(shù)字時(shí)鐘實(shí)驗(yàn)報(bào)告_第4頁(yè)
2023年VHDL數(shù)字時(shí)鐘實(shí)驗(yàn)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩29頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

VHDL數(shù)字時(shí)鐘設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?

進(jìn)一步練習(xí)VHDL語(yǔ)言設(shè)計(jì)工程的建立與仿真的環(huán)節(jié)和方法、熟悉VHDL

語(yǔ)言基本設(shè)計(jì)實(shí)體的編寫(xiě)方法。同時(shí),在已有知識(shí)的基礎(chǔ)上,簡(jiǎn)樸綜合編寫(xiě)程序,仿制簡(jiǎn)

樸器械。

二、實(shí)驗(yàn)環(huán)境:

PC個(gè)人計(jì)算機(jī)、WindowsXP操作系統(tǒng)、QuartusII集成開(kāi)發(fā)環(huán)境軟件。

三、設(shè)計(jì)規(guī)定:

運(yùn)用VHDL語(yǔ)言編寫(xiě)一個(gè)數(shù)字鐘,具體規(guī)定:

1.具有時(shí)、分、秒計(jì)數(shù)的十進(jìn)制數(shù)字顯示功能,以24小時(shí)循環(huán)計(jì)時(shí)。

2.具有手動(dòng)調(diào)節(jié)小時(shí),分鐘的功能。

。3.具有鬧鐘的功能,可以在設(shè)定的鬧鐘時(shí)間發(fā)出鬧鈴聲。

四、實(shí)驗(yàn)環(huán)節(jié):

1.定義輸入輸出信號(hào)量

£?port(

elk:instd_logic;-時(shí)鐘

speak:outstd_logic;一一鈴

。dout:outstd_1ogic_vector(7downto0);---晶體管顯示

setc1k:instd_logic_vector(2downto0);---操作按鈕

odl,d2,d3,d4,d5,d6:outstd_logic);--—六個(gè)晶體管

2.定義結(jié)構(gòu)體中的信號(hào)量

signa1sei:std_logic_vector(2downto0);

signalhou1:std_1ogic_vector(3downto0);--時(shí)分秒的個(gè)位和十位

signalhou2:std__logic_vector(3downto0);

signa1min1:std_1ogic_vector(3downto0);

signa1min2:std_logic_vector(3downto0);

signalsethl:std」ogic_vector(3downto0);

signa1seth2:std_1ogic_vector(3downto0);

signa1setmkstd_Iogic_vector(3downto0);

signa1setm2:std_1ogic_vector(3downto0);

signalseel:std」ogic_vector(3downto0);

signalsec2:std_logic_vector(3downto0);

signalh1:std_logic_vector(3downto0);

signalh2:std_logic_vector(3downto0);

signa1m1:std_1ogic_vector(3downto0);

signalm2:std_logic_vector(3downto0);

signalsi:std_1ogic_vector(3downto0);

signals2:std_logic_vector(3downto0);

signalsph1,sph2,spml,spm2,spsi,sps2:std_1ogic_vector(3downto0);

signalcount_sec:std_1ogic_vector(9downto0);

signalsec_co?:std_logic;

signalcol,co2,co3,co4:std」ogic;-----進(jìn)位

signalswitch:std」ogic_vector(1downto0);--表達(dá)狀態(tài)

3.分頻模塊

用來(lái)定義秒count_sec用來(lái)計(jì)時(shí)鐘個(gè)數(shù),當(dāng)count_sec=時(shí),及得到1Hz信號(hào)。代碼如

下:

process(elk)is。。一defineasecond

begin

sif(clk*eventandclk='l')then

if(count__sec=,u,)then

00countsec<=

sec_co<=/I,;

eIse

count_sec<=count_sec+'1

。sec_co<=*0

endif;

endif;

endprocess;<>

4.時(shí)鐘正常走時(shí)模塊

該模塊使用6個(gè)進(jìn)程實(shí)現(xiàn),分別為秒個(gè)位計(jì)時(shí)、秒十位計(jì)時(shí)、分個(gè)位計(jì)時(shí)、分十位計(jì)時(shí)、

時(shí)個(gè)位計(jì)時(shí)、時(shí)十位計(jì)時(shí)。

process(sec_co)is。。-----—一秒個(gè)位

begin

ifswitch=",00Mthen■■正常狀態(tài)

。ifsec_co=Tihen

。ifsec2=M1001Mthen

sec2<="0000”;

。coi<=zr;

。e1se

。sec2<=sec2+,11;

colV='0';

。endif;

endif;

elsifswitch=H01"then。--調(diào)時(shí)狀態(tài)

sec2<=H0000”;

endif;

endprocess;

process(col)is。一一--一秒十位

begin

ifswitch="00"then

ifcoTeventandcol=,「then

oif(secl=n0101M)then

^secl<="0000”;

oco2<=*1*;

?else

oosec1<=secl+f1*;

00co2V='0';

endif;

endif;

elsifswitch="01nthen

osecl<=uOOOOH;

endif;

endprocess;

process(col,co2)is--——---分鐘個(gè)位

begin

ifswitch=“00“then

co2*eventandco2=*1'then

oifmin2="1001"then

omin2<=M0000”;

co3<='1r;

else

omin2<=min2+'1';

co3<='0,;

endif;

?endif;

elsifswitch=nOr'then

min2<=setm2;

endif;

endprocess;

process(co3)is-------------------分鐘十位

begin

ifswitch=“00”then

ifco3=*rthen

ifminl=n0101nthen

minl<="0000”;

,z

eCo4<=1;

eIse

minl<=minl+'l';

。co4V='0\

oendif;

endif;

e1sifswitch="01uthen

minl<=setml;

endif;

endprocess;

process(co4)?!鲆灰灰恍r(shí)

begin

ifswitch=n00"then

ifco4=rthen

。if(houl=nOO10")then。-一小時(shí)十位為2時(shí),個(gè)位滿(mǎn)3進(jìn)一

。if(hou2=H0011")then

。。。hou2<=n0000”;

houl<=M0000”;

。。<?else

ou2<=hou2+'1';

J?endif;

o?else??■一小時(shí)十位為0或1,個(gè)位滿(mǎn)9進(jìn)一

。if(hou2=01001")then

。。hou2<=nOOOOn;

houl<=houl+,l,;

else

hou2<=hou2+'1';

。endif;

eendif;

aendif;

elsifswitch=n01"then

。houl<=sethl;

hou2<=seth2:

endif;

endprocess;

5.調(diào)時(shí)模塊

該進(jìn)程用來(lái)控制時(shí)鐘狀態(tài),switch為“00”時(shí)正常顯示時(shí)間,為“01”時(shí)是進(jìn)

行調(diào)時(shí),

為“10”時(shí)是設(shè)立鬧鐘時(shí)間。代碼如下:

process(setc1k(0))is。

begin

if(setcIk(0)zeventandsetclk(0)=T)then

if(switch=n10n)then

,,,,

switch<=00;

eIse

switch<=switch+'1

endif;

endif;

endprocess;

process(setclk(2),switch,setcIk(1))is

begim。--setclk(1)為1調(diào)分

if(switch="01"andsetclk(1)=,1/)then

if(setclk(2)'eventandsetc1k(2)=「)then

。if(setm2=1001")then

。setm2<=uOOOO";

if(setml=n0101")then

setm1<=n0000H;

。e1se

。。setml<=setml+'l';

。endif;

else

setm2<=setm2+,l1;

endif;

endif;

endif;

endprocess;

process(setc1k(2),switch,setclk(1))is

begin-setcIk(1)為0調(diào)時(shí)

if(switch=M01Handsetc1k(l)='0')then

if(setclk(2)'eventandsetclk(2)=r1r)then

。。if(seth1=M0010")then

。。if(seth2=n00ir')then

8seth1<=H0000n;

。。seth2<=n0000M;

。eIse

。。?seth2<=seth2+*1*;

o。endif;

。eIse

。if(seth2=H1001n)then

o。。sethl<=seth1+T;

“seth2<=H0000u;

o。else

*oseth2<=seth2+*1';

endif;

?endif;

endif;

endif;

endprocess;

,6.鬧鐘模塊

該模塊由3個(gè)小模塊組成,分別為設(shè)立鬧鐘時(shí)間、判斷鬧鐘時(shí)間是否到達(dá)以及鬧鈴聲音模

塊。

。(1)設(shè)立鬧鐘時(shí)間模塊

該進(jìn)程用于設(shè)立鬧鐘時(shí)間。

信號(hào)量switch為410'時(shí),表達(dá)設(shè)立鬧鐘時(shí)間;。

if(switch="10")then-----調(diào)鬧鐘時(shí),顯示鬧鐘設(shè)立時(shí)間

ifse1="000”then

odl<='0';

?casesph1is

。when0000',=>dout<=,,l1000000";

。when),0001',=>dout<=,,l1111001n;

owhen"00100=>dout<=n10100100H;

owhenothers=>dout<="XXXXXXXXM;

endcase;

elsifsei=',001,'then

od2<='0';

?casesph2is

whenuOOOOM=>dout<="11000000M;

owhen,,000r,=>dout<=Mlll1100ln;

owhen”0010H=>dout<=H10100100H;

>when0001ln=>dout<=nl01100000;

。when"0100"=>dout<=010011001";

gwhen”0101,,=>dout<=H10010010";

whenn0110"=>dout<=*'l0000010H;

whenH0111°=>dout<=M11111000”;

◎when01000"=>dout<="10000000";

when*'1001',=>dout<=',10010000,';

whenothers=>dout<=uXXXXXXXX";

?endcase;

elsifsel="010"then

8d3v='O';

casespm1is

when"0000"=>dout<=u11000000H;

owhen"000l"=>dout<="11111001

when,10010,'=>dout<=,,10100100”;

。when"0011n=>dout<=<*10110000";

owhen"0100°=>dout<=nl0011OOI

。。when“0101”=Adout<="10010010M;

3whenothers=>dout<=nXXXXXXXX";

?endcase;

?e1sifsel="011"then

od4<=,0,;

6casespm2is

whenn0000n=>dout<="11000000”;

owhen,'0001',=>dout<=011111001”;

whenM0010"=>dout<=M10100100";

henH0011H=>dout<=u10110000M;

gwhen,,0100,'=>dout<=Hl001100

zhen“0101”=>doutv="10010010*1;

when"Oil0H=>dout<=n10000010”;

owhenM01ir'=>dout<=n11111000*';

when"1000"=>dout<=M10000000”;

owhen”1001M=>dout<=n10010000”;

whenothers=>dout<=°XXXXXXXX;

oendcase;

eIsifse1=H100nthen

d5<='O';

casespsiis

。when"0000"=>dout<="ll000000";

。?when"0001"=>dout<="11111001";

。。when"0010"=>dout<="10100100";

"when"0011"=>dout<="10110000";

。?when"0100"=>dout<="10011001

。。?when"0101"=>dout<="10010010

?whenothers=>dout<="XXXXXXXX";

endcase;

oelsifsel="l01"then

d6<=,0';

。casesps2is

?when"0000"=>dout<="11000000";

。when"0001"=>dout<="11111001";

。?when"0010"=>dout<="10100100";

。when"00ll"=>dout<="10110000";

?when"0100"=>dout<="l0011001";

。。when"0101"=>dout<="10010010";

?when"0110"=>dout<="10000010";

when"0lll"=>dout<="11111000";

。?when"1000"=>dout<="10000000";

。?when"1001"=>dout<="10010000";

。whenothers=>dout<="XXXXXXXX";

endcase;

endif;。

?(2)鬧鈴聲音模塊

通過(guò)度頻產(chǎn)生蜂鳴,即發(fā)出鬧鈴聲音。

process(switch)is^——------鬧鈴

begin。設(shè)立鬧鈴時(shí)秒歸零

ifswitch=u10"then

sps1<="0000”;

sps2<=u0000";

endif;

endprocess;

process(switch,setc1k(2),setcIk(1))is

begin

if(switch=H10Handsetclk(l)-11)then

if(setelk(2)reventandsetclk(2)=,l')then

if(spm2=n1001H)then

spm2<=H0000”;

ooif(spm1=n0101")then

。spm1<="0000”;

else

spml<=spml+'l';

endif;

else

spm2<=spm2+'1';

?endif;

endif;

endif;

endprocess;

process(switch,setc1k(2),setc1k(1))is

begin

。if(switch=*'10"andsetclk(l)='O,)then

。if(setclk(2)*eventandsetc1k(2)=,r)then

if(sphl="0010")then

eif(sph2=n0011°)then

s8。sphl<=M0000";

。。sph2<='10000n;

*else

sph2<=sph24-T;

?。endif;

eelse

。。if(sph2=H100r')then

3sph2<=H0000";

0°0sphl<=sphl+,r;

0。e1se

e。。。。sph2<=sph2+T;

e。endif;

egendif;

endif;

。endif;

endprocess;

process(clk,sphl,sph2,spml,spm2,hou1,hou2,min1,min2)is

。begin

if(sphl=hou1andsph2=hou2andspm1=min1andspm2=min2)t

hen

。speak<=clk;

else

8。speak<='0';

。endif;

endprocess;

7.數(shù)碼管顯示模塊

(1)選擇時(shí)間顯示

process(key1,key2,change)

begin

if(key1=z0z)and(key2=9O')then

“osec_0<=sec_00;

?sec_l<=sec_11;

omin_0<=min_00;

gmin_l<=min_ll;

。hour_1<=hour_11;

“hour_0<=hour_00;

。eIsif(key1='1f)and(key2=rO')then

sec_0<=sec__000;

ssec_l<=sec_111;

e,min_0<=min_000;

Q<>min_l<=min_111;

ghour_0<=hour_000;

hour_l<=hour_111;

oe1sif(keyl=,0,)and(key2=/l*)then

。sec_0<=sec_0000;

。6sec_1<=sec_llll;

gmin_0<=min_0000;

?<>min_1<=min_1111;

。hour_0<=hour_0000;

。hour_1<=hour_llll;

oendif;

?endprocess;

(2)數(shù)碼管時(shí)間顯示

ifse1="000”then

dl<='0';

ocaseh1is

whenn0000H=>dout<=nl1000000";

“whenn0001u=>dout<=H11111001,f;

o。when"0010n=>dout<="10100100”;

?whenothers=>dout<=*'XXXXXXXX

oendcase;

oelsifsel=M001Hthen

d2v='0>;

?caseh2is

。whenu0000'*=>dout<=M11000000";

whenu0001M=>dout<="11111001u;

when"0010u=>dout<=n10100100H;

。whenM001lu=>dout<=u10110000";

owhen00100"=>dout<=n10011001*1;

。whenn0101n=>dout<=n10010010”;

。。whenH0110"=>dout<="10000010";

owhenH011lu=>dout<="lllll000";

owhen"1000n=>dout<="10000000";

o。whenH1001n=>dout<="100100000;

“whenothers=>dout<=HXXXXXXXXH;

“endcase;

。elsifsel="010Hthen

。d3<=z01;

。casem1is

的when"0000"=>dout<=u11000000”;

。^whenH0001"=>dout<='(11111001";

when"0010u=>dout<=H10100100";

。,when"0011"=>dout<="10110000”;

“when”0100u=>dout<=H10011001H;

,owhen"010l"=>dout<=n10010010”;

whenothers=>dout<="XXXXXXXX”;

ooendcase;

elsifsel=HOil"then

8d4<='0';

casem2is

“when”0000H=>dout<="11000000n;

。when-0001K=>dout<=nl1111001”;

,when“0010”=>dout<="l0100100”;

◎when"0011”=>dout<="10110000";

when,,0100,,=>dout<=010OllOOl',;

。when0010l”=>doutv="10010010M;

“when”0110n=>dout<=n10000010”;

gowhen"011l"=>dout<=”11111000";

“when”1000”=>dout<="10000000”;

whenn1001"=>dout<=nl0010000M;

gwhenothers=>dout<="XXXXXXXX

?endcase;

elsifse1=nl00Mthen

d5<=<0';

“casesiis

o^when"0000n=>dout<=u11000000

◎when"0001n=>dout<=011111001n;

ahen"0010H=>dout<=M10100100”;

owhen"00Hu=>dout<=H10110000

。when"0100"=>dout<=u10011001”;

“?whenn0101M=>dout<=n10010010”;

°。whenothers=>dout<=MXXXXXXXXK;

gendcase;

e1sifse1=n101nthen

8d6v='O';

ocases2is

when"0000n=>dout<=nl1000000M;

owhen000r'=>dout<=H11111001M;

awhen"0010n=>dout<=n10100100

。when,100ir,=>dout<=,,10110000”;

。owhenn0100"=>dout<="10011001,r;

。when”010ln=>dout<=n10010010”;

“whenM0110"=>dout<=u10000010";

s<?when”0111M=>dout<=H111110000;

owhen“1000”=>doutv="10000000n;

。->whenH100r'=>dout<=n10010000'1;

。whenothers=>dout<="XXXXXXXX";

。endcase;

endif;

五、實(shí)驗(yàn)結(jié)果分析總結(jié):

該程序基本實(shí)現(xiàn)了數(shù)字時(shí)鐘的基本功能,可以正常走時(shí),并且可以校正時(shí)間,還可以

進(jìn)行鬧鐘設(shè)立。

通過(guò)這次VHDL課程設(shè)計(jì),我學(xué)到了很多,對(duì)于原本掌握的不好的數(shù)字邏輯相關(guān)知

識(shí),在課程設(shè)計(jì)具體實(shí)踐中有了很深刻的結(jié)識(shí),在對(duì)于QuartusII的操作上也有很大

的提高,增長(zhǎng)了操作的純熟限度,現(xiàn)在我已有信心做任何的設(shè)計(jì)課題。

在編程中還碰到其他一些小問(wèn)題,有好多都是由于不夠細(xì)心,不夠嚴(yán)謹(jǐn)導(dǎo)致的,通過(guò)編

程,我會(huì)一步步養(yǎng)成一個(gè)好的編程習(xí)慣,盡量避免一些不必要的錯(cuò)誤,一步步提高自己。

在此后的學(xué)習(xí)中,我還需要不斷學(xué)習(xí),不斷鍛煉自己。

六、附:源代碼

libraryieee;

useieee.std_logic_l164.all;

useieee.std_logic_unsigned.a11;

entityclockis

叩ort(

3clk:instd_logic;?一時(shí)鐘

speak:outstd_1ogic;一鈴

dout:outstd_logic_vector(7downto0);---晶體管顯示

esetclk:instd_logic_vector(2downto0);---操作按鈕

d1,d2,d3,d4,d5,d6:outstd_logic);---六個(gè)晶體管

endentityclock;

architectureoneofclockis

signalsei:std_1ogic_vector(2downto0);

signa1hou1:std_logic_vector(3downto0);--時(shí)分秒的個(gè)位和十位

signalhou2:std_logic_vector(3downto0);

signalmini:std」ogic_vector(3downto0);

signalmin2:std_1ogic_vector(3downto0);

signalseth1:std_logic_vector(3downto0);

signalseth2:std_1ogic_vector(3downto0);

signalsetml:std_logic_vector(3downto0);

signa1setm2:std_logic_vector(3downto0);

signa1sec1:std_1ogic_vector(3downto0);

signa1sec2:std_1ogic_vector(3downto0);

signa1h1:stdjogic_vector(3downto0);

signa1h2:std_logic__vector(3downto0);

signa1ml:std_logic_vector(3downto0);

signa1m2:std」ogic_vector(3downto0);

signa1sl:std_logic_vector(3downto0);

signals2:std_1ogic_vector(3downto0);

signa1sphl,sph2,spm1,spm2,spsl,sps2:std.c_vector(3downto0);

signa1count_sec:std」ogic_vector(9downto0);

signalsec_co:std_1ogic;

signalcol,co2,co3,co4:std_1ogic;■■進(jìn)位

signalswitch。:std_logic_vector(1downto0);--表達(dá)狀態(tài)

begin

process(elk)is--defineasecond

begin

。if(clk'eventandcIk-11)then

。if(count_sec="")then

count_sec<=,H,;

。osec_co<-I*;

eIse

count_sec<=count_sec+'1';

sec_co<=,0,;

endif;

endif;

endprocess;

process(sec_co)is。一一一?一-----一秒個(gè)位

begin

ifswitch="00"then。--正常狀態(tài)

。ifsec_co='l'then

。。ifsec2=nl001Mthen

^sec2<="0000H;

。coi<=,r;

8e1se

o*?sec2<=sec2+,l,;

08COl<='O';

endif;

oendif;

elsifswitch=M01nthen一調(diào)時(shí)狀態(tài)

sec2<=n0000”;

endif;

endprocess;

process(col)is??——--------秒十位

begin

ifswitch=1100"then

?ifcol*eventandco1=Tthen

”if(sec1="0101H)then

eoseel<="0000n;

□co2<-r;

??else

“secl<=secl+T;

。。co2<='0,;

。endif;

?endif;

elsifswitch="01"then

seel<="0000”;

endif;

endprocess;

process(co1,co2)is......--一分鐘個(gè)位

begin

ifswitch=n00"then

“fco2'eventandco2=*1rthen

“ifmin2="1001"then

。min2<="0000,';

8OCO3<='1';

^else

min2<=min2+'l';

。co3<='0,;

空ndif;

?endif;

elsifswitch=MO1"then

min2<=setm2;

endif;

endprocess;

process(co3)is-------——分鐘十位

begin

ifswitch="00"then

fco3=1'then

“fmini="0101nthen

如mini""0000”;

3?>co4<=,1';

else

。omin1<=minl4-'1

°。co4<=,0,;

。endif;

eendif;

elsifswitch="01"then

minl<=setml;

endif;

endprocess;

process(co4)6-----一小時(shí)

begin

ifswitch=M00uthen

。ifco4=,1'then

“if(hou1=M0010")then-小時(shí)十位為2時(shí),個(gè)位滿(mǎn)3進(jìn)一

。if(hou2="0011M)then

。。。由0u2<=H0000n;

^houl<=n0000n;

6else

。ohou2<=hou2+'r;

“endif;

else。。。一-小時(shí)十位為0或1,個(gè)位滿(mǎn)9進(jìn)一

。。if(hou2=n1001H)then

hou2<='*0000

。。houl<=houl+*r;

。e1se

8ghou2v=hou2+'1';

◎endif;

endif;

endif;

elsifswitch="01"then

ohou1<=seth1;

hou2<=seth2;

endif;

endprocess:

process(setclk(O))is。■一控制時(shí)鐘狀態(tài),0。正常,01調(diào)時(shí),10鬧鐘

begin

if(setclk(0/eventandsetclk(0)=,lf)then

aif(switch=H10n)then

8oswitch<="00";

ooe1se

。switch<=switch+'l';

eendif;

6endif;

endprocess;

process(setclk(2),switch,setclk(1))is

begin。-setclk(1)為1調(diào)分

if(switch=n01"andsetclk(1)=T)then

if(setc1k(2)reventandsetclk(2)-T)then

。if(setm2=M1001")then

。setm2<=n0000";

geif(setml="0101H)then

。setml<=,,0000,,;

。oelse

osetml<=setml+,r;

。endif;

else

osetm2<=setm2+T;

gendif;

sendif;

endif;

endprocess;

process(setc1k(2),switch,setelk(1))is

begin<>--setclk⑴為0調(diào)時(shí)

?if(switch="01"andsetclk(1)='0')then

eif(setclk(2)'eventandsetc1k(2)-11)then

。if(seth1="0010°)then

。。if(seth2=H0011H)then

8sethlv="0000”;

。oseth2<="0000”;

gelse

。oseth2<=seth2+11*;

g>endif;

gelse

if(seth2=nlOOI”)then

osethl<=sethl+'r;

。oseth2<=n0000n;

odelse

gseth2<=seth2+'l';

。。endif;

、endif;

。endif;

endif;

endprocess;

process(switch)is。o---一一鬧鈴

begino-設(shè)立鬧鈴時(shí)秒歸零

oifswitch=n10Mthen

spsl<="0000”;

。sps2<="0000”;

?endif;

endprocess;

process(switch,setc1k(2),setclk(1))is

begin

?if(switch="10"andsetc1k(1)=*r)then

if(setclk(2)'eventandsetclk(2)=*1*)then

s“f(spm2="1001")then

。。spm2<=n0000n;

nn

川if(spml=0101)then

。。。spml<=,'0000”;

o笛Ise

gspm1<=spml+z1';

3ndif;

。eIse

sspm2<=spm2+,r;

gendif;

oendif;

?endif;

endprocess;

process(switch,setclk(2),setelk(1))is

begin

if(switch=n10"andsetclk(1)=,0,)then

if(setclk(2)'eventandsetclk(2)='r)then

if(sphl=H0010n)then

H

doqf(sph2=0011")then

gosphl<=nOO00

。。sph2<=H0000”;

eIse

?asph2<=sph2+T;

。怕ndif;

??誌se

8oif(sph2="1001")then

。sph2<=n0000n;

。。。sphl<=sphl+*1';

。oeIse

。。sph2<=sph2+T;

g>endif;

。oendif;

endif;

空ndif;

endprocess;

process(clk,sph1,sph2,spml,spm2,hou1,hou2,min1,min2)is

begin

if(sphl=hou1andsph2=hou2andspml=minlandspm2=min2)then

ospeak<=clk;

else

?speak<-0,;

endif;

endprocess;

process(c1k)°。一?一一模6計(jì)數(shù)

begin。。。一控制晶體管顯示

oifclk'eventandc1k-1*then

“fse1="101uthen

?se1<=H000”;

ee1se

。。。sel<=se1+T;

sendif;

oendif;

endprocess;

process(sel)is

begin

?hl<=houl;h2<=hou2;ml<=min1;m2<=min2;sl<=secl;s2<=sec2;

odl<=,l,;d2<=/r;d3〈二'「;d4v='I1;*8d5<=,l';d6<=,r;

if(switch=M1O^then—調(diào)鬧鐘時(shí),顯示鬧鐘設(shè)立時(shí)間

oifsel=n000"then

8dl〈二O;

Qcasesphiis

gwhen“0000”=>dout<="11000000";

ewhenn0001"=>dout<=M11111001M;

。^when"0010H=>dout<="10100100H;

owhenothers=>dout<="XXXXXXXX”;

gendcase;

elsifsel="001"then

8d2<='0';

casesph2is

?when"0000M=>dout<="110OOOOO";

“when”0001M=>dout<="11111001”;

。whenn0010H=>dout<="l0100100”;

owhenH0011"=>dout<=H10110000";

whenH0100n=>dout<=H10011001n;

when"0101M=>dout<="10010010";

-whenH0110"=>dout<=n10000010n;

whenu0111H=>dout<=Hl1111000”;

ooowhenM1000,,=>dout<=,,l0000000u;

。。whenn1001n=>dout<=M100100000;

whenothers=>dout<=MXXXXXXXXH;

ndcase;

elsifse1="010”then

d3<='0';

ocasespm1is

◎when,'0000n=>dout<="l1000000";

8whenH0001,,=>dout<=,,1111100r,;

^when"0010"=>dout<="10100100";

。when”0011H=>dout<=M10110000";

?when"0100H=>dout<=n10011001H;

。when"0101n=>dout<=M10010010";

。owhenothers=>dout<=*'XXXXXXXX

&endcase;

elsifsel="0H"then

K14<='0,;

casespm2is

◎when,'0000',=>dout<=n11000000";

。when"0001"=>dout<="11111001";

。owhen"0010"=>dout<=u10100100”;

0^when"0011"=>dout<="10110000M;

?when"01OOn=>dout<=H10011001”;

。whenu0101u=>dout<=Hl0010010”;

。when"0110H=>dout<="10000010”;

gowhen“0111"=>dout<=Hlllll000”;

。。whenn1000u=>dout<="10000000”;

。owhen,'10010=>dout<='*10010000n;

whenothers=>dout<="XXXXXXXXn;

“endcase;

e1sifsel=*'100"then

M5<=O;

◎casesps1is

when,'0000,'=>dout<=011000000”;

when"0001"=>dout<=nlllll001M;

。when”0010°=>dout<=M10100100”;

when"00HH=>dout<="10110000";

^when"0100n=>dout<=n10011

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論