基于eda的萬年歷設(shè)計說明_第1頁
基于eda的萬年歷設(shè)計說明_第2頁
基于eda的萬年歷設(shè)計說明_第3頁
基于eda的萬年歷設(shè)計說明_第4頁
基于eda的萬年歷設(shè)計說明_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、 EDA設(shè)計實驗報告學校:大學專業(yè):測控技術(shù)與儀器班級:一班:史占東輔導老師:郭敏一、設(shè)計要求:(1)、能夠顯示年、月、日、時、分、秒、星期;并具有閏年判斷補償功能;(2)、具有整點報時與定時功能;二、實用方法:設(shè)計中用到了6個按鍵,在模式5下,K1,K2,K3,K4,ZHENG,NAO;其中K1用于切換顯示模式,剛開始時顯示時間,按兩次K1顯示定時時間,再按兩次K1顯示日期,再按兩次重新顯示時間;K2用于控制中間信號W,每按下兩下中間信號加一,加至8時清零,W=1時,每按兩下K3鍵分鐘加一;W=2時,每按兩下K3鍵小時加一;W=3時,每按兩下K3鍵星期加一;W=4時,每按兩下K3鍵日期加一;

2、W=5時,每按兩下K3鍵月份加一;W=6時,每按兩下K3鍵年低兩位加一;W=7時,每按兩下K3鍵年高兩位加一;W=8時,當K4=0時,每按兩下K3鍵定時分鐘加一;當K4=1時,每按兩下K3鍵定時小時加一;按鍵ZHENG為整點報時的使能端;按鍵NAO為定時鬧鐘的使能端。 三、程序與仿真:(1)24進制計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entityt24 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 do

3、wnto 0);cout:out std_logic);endt24;architecture one oft24 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq11<=q11+1;if q11=9 then q11<=(others=>'0');q22<=q22+1;end if;if q22=2 and q11=3 then q22<="0000"q11

4、<="0000"cout<='1'else cout<='0'end if;end if;end process;q1<=q11;q2<=q22;end;(2)60進制計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entityt60 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);cout:out std_logi

5、c);endt60;architecture one oft60 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq11<=q11+1;if q11=9 then q11<=(others=>'0');q22<=q22+1;end if;if q22=5 and q11=9 then q22<="0000"q11<="0000"cout

6、<='1'else cout<='0'end if;end if;end process;q1<=q11;q2<=q22;end;(3)天計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity day isport(clk,s1,s2:in std_logic;d1,d2:out std_logic_vector(3 downto 0);cout:out std_logic);end day;architectu

7、re one of day issignal q11,q22:std_logic_vector(3 downto 0);signal s1s2:std_logic_vector(1 downto 0);beginprocess(clk,s1,s2)beginif clk'event and clk='1' thenq11<=q11+1;if q11=9 then q11<=(others=>'0');q22<=q22+1;end if;s1s2<=s1&s2;case s1s2 iswhen "00&quo

8、t;=>if q22=3 and q11=1 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when "01"=>if q22=3 and q11=0 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when "10"=&

9、gt;if q22=2 and q11=8 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when "11"=>if q22=2 and q11=9 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when others=>null;end

10、case;end if;end process;d1<=q11;d2<=q22;end;(4)月計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity month isport(clk,run:in std_logic;m1,m2:out std_logic_vector(3 downto 0);a,b,cout:out std_logic);end month;architecture one of month issignal q1,q2:std_lo

11、gic_vector(3 downto 0);signal q2q1:std_logic_vector(7 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<=(others=>'0');q2<=q2+1;end if;if q2=1 and q1=2 then q2<="0000"q1<="0001"cout<='1'else cout

12、<='0'end if;end if;q2q1<=q2&q1;case q2q1 is when"00000001"=>a<='0'b<='0' when"00000010"=>if run='1' then a<='1'b<='1'else a<='1'b<='0' end if; when"00000011"=>a<='

13、;0'b<='0' when"00000100"=>a<='0'b<='1' when"00000101"=>a<='0'b<='0' when"00000110"=>a<='0'b<='1' when"00000111"=>a<='0'b<='0' when"00001000&

14、quot;=>a<='0'b<='0' when"00001001"=>a<='0'b<='1' when"00010000"=>a<='0'b<='0' when"00010001"=>a<='0'b<='1' when"00010010"=>a<='0'b<='0'

15、 when others=>null;end case;end process;m1<=q1;m2<=q2;end;(5)年低兩位計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity year isport(clk:in std_logic;y1,y2:out std_logic_vector(3 downto 0);run,cout:out std_logic);end year;architecture one of year issignal

16、 q1,q2,q3:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<=(others=>'0');q2<=q2+1;end if;if q2=9 and q1=9 then q2<="0000"q1<="0000"cout<='1'else cout<='0'end if;en

17、d if;end process;process(clk)beginif clk'event and clk='1' thenq3<=q3+1;if q3=3 then q3<=(others=>'0');run<='1'else run <='0'end if;end if;y1<=q1;y2<=q2;end process;end;(6)年高兩位計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_l

18、ogic_unsigned.all;entity year1 isport(clk:in std_logic;y3,y4:out std_logic_vector(3 downto 0);run,cout:out std_logic);end year1;architecture one of year1 issignal q1,q2:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<=(others

19、=>'0');q2<=q2+1;end if;if q2=9 and q1=9 then q2<="0000"q1<="0000"cout<='1'else cout<='0'end if;end if;end process;process(q1)beginif q1(1 downto 0)/="00" thenrun<='1'else run <='0'end if;y3<=q1;y4<=q2

20、;end process;end;(7)星期計數(shù)器程序與仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entityt7 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);endt7;architecture one oft7 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk=

21、'1' thenq11<=q11+1;if q11=7 then q11<="0001"end if;end if;q22<="0000"end process;q1<=q11;q2<=q22;end;(8)調(diào)節(jié)時間與實現(xiàn)定時程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tiaoshi isport(sout,fout,hout,dout,mout,yout0:in std_logic;

22、k2,k3:in std_logic;fin,hin,din,min,yin0,yin1,dingshi,win:out std_logic;q:out std_logic_vector(3 downto 0);end tiaoshi;architecture one of tiaoshi issignal w:std_logic_vector(3 downto 0);beginprocess(k2,k3)beginif k2'event and k2='1' then w<=w+1;if w=8 then w<="0000"end if

23、;end if;case w is when "0000"=>fin<=sout;hin<=fout;din<=hout;min<=dout;yin0<=mout;yin1<=yout0;dingshi<='0'win<=hout; q<="0000" when "0001"=>fin<=k3;hin<='0'din<='0'min<='0'yin0<='0'y

24、in1<='0'dingshi<='0'win<='0' q<="0001" when "0010"=>fin<='0'hin<=k3;din<='0'min<='0'yin0<='0'yin1<='0'dingshi<='0'win<='0' q<="0010"when "0011&

25、quot;=>fin<='0'hin<='0'din<='0'min<='0'yin0<='0'yin1<='0'dingshi<='0'win<=k3; q<="0011" when "0100"=>fin<='0'hin<='0'din<=k3;min<='0'yin0<='0'yi

26、n1<='0'dingshi<='0'win<='0' q<="0100" when "0101"=>fin<='0'hin<='0'din<='0'min<=k3;yin0<='0'yin1<='0'dingshi<='0'win<='0' q<="0101" when "0110&

27、quot;=>fin<='0'hin<='0'din<='0'min<='0'yin0<=k3;yin1<='0'dingshi<='0'win<='0' q<="0110" when "0111"=>fin<='0'hin<='0'din<='0'min<='0'yin0<='

28、0'yin1<=k3;dingshi<='0'win<='0' q<="0111" when "1000"=>fin<='0'hin<='0'din<='0'min<='0'yin0<='0'yin1<='0'dingshi<=k3; q<="1000" when others=>null;end case;end p

29、rocess;end;(9)切換顯示狀態(tài)程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity control isport(fld,fhd,hld,hhd,sl,sh,fl,fh,hl,hh,dl,dh,ml,mh,yl,yh,yl1,yh1,wl,wh:in std_logic_vector(3 downto 0);k1:in std_logic;q1,q2,q3,q4,q5,q6,q7,q8:out std_logic_vector(3 downto 0);l1:out st

30、d_logic_vector(3 downto 0);end control;architecture one of control issignal w:std_logic_vector(1 downto 0);beginprocess(k1)begin if k1'event and k1='1' then w<=w+1;if w=2 then w<="00"end if; end if;case w iswhen"00"=>q8<=yh1;q7<=yl1;q6<=yh;q5<=yl;q4<=mh;q3<=ml;q2<=dh;q1<=dl;l1<="0000"when"01"=>q8<=wh;q7<=wl;q6<=hh;q5<=hl;q4<=fh;q3<=fl;q2<=sh;q1<=sl;l1<="0001"when"10"=>q8<=&qu

溫馨提示

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

評論

0/150

提交評論