VHDL--數字鐘_第1頁
VHDL--數字鐘_第2頁
VHDL--數字鐘_第3頁
VHDL--數字鐘_第4頁
全文預覽已結束

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、1實驗目的1 學習數字鐘的基本原理2 學習數字鐘的基本設計方法3 學習數字鐘的校時控制的基本設計方法4 學習數字鐘的中可變進制計數器的設計方法5 掌握采用 VHDL 語言設計頻率測量和周期測量2實驗原理數字鐘的主要功能有年月日時分秒的顯示輸出功能,以及對日期和時間進行設置的功能,還可以有整點報時,鬧鐘功能。設計數字鐘的核心問題是時鐘日期的自動轉換功能。即自動識別不同月份的天數不同的控制。據此可以設計一個如圖3-13 所示結構的數字鐘,該數字鐘包括校時模塊、月份天數處理模塊、時分秒計時模塊、年月日模塊和輸出選擇模塊。圖3-13 數字鐘原理框圖3實驗內容1根據圖3-13 設計數字鐘的各模塊電路2仿

2、真設計結果3用vhdl 語言完成設計4分析設計方法,選擇最佳方案完成天數處理功能5設計兩鍵校時操作4設計實例library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity digital_clock isport(clk,iset,oset,en:in std_logic;i1,i2,i3,i4:std_logic_vector(3 downto 0);o1,o2,o3,o4,o5,o6:out std_logic_vector(3 down

3、to 0);end digital_clock;architecture rtl of digital_clock issignal hmd:integer; -meiyuetianshusignal zs,om:std_logic_vector(1 downto 0); -:=signal ya,yb,yc,yd,moa,mob,da,db,ha,hb,ma,mb,sa,sb,ms:std_logic_vector(3 downto 0); -shuchusignal bya,byb,byc,byd,bmoa,bmob,bda,bdb,bha,bhb,bma,bmb,bsa,bsb,bms:

4、std_logic_vector(3 downto 0); -shurubeginin_set:process(iset)beginif(iset='1' and iset'event) thenzs<=zs+'1'end if;end process in_set;out_set:process(oset)beginif(oset='1' and oset'event) thenom<=om+'1'end if;end process out_set;input:process(zs,iset)beg

5、inif(iset='1' and iset'event) thenbsa<="0000"bsb<="0000"bms<="0000"if zs="00" thenbya<=i1;byb<=i2;byc<=i3;byd<=i4;elsif zs="01" thenbmoa<=i1;bmob<=i2;bda<=i3;bdb<=i4;elsif zs="10" thenbha<=i1;

6、bhb<=i2;bma<=i3;bmb<=i4;elseend if;end if;end process input;output:process(om,oset)beginif om="01" theno1<=ma;o2<=mb;o3<=sa;o4<=sb;o5<=ms;o6<="0000"elsif om="10" theno1<=moa;o2<=mob;o3<=da;o4<=db;o5<=ha;o6<=hb;elsif om="

7、11" theno1<='0' & week;o2<="0000"o3<=ya;o4<=yb;o5<=yc;o6<=yd;elseend if;end process output;a1:process(clk)beginif(clk='1' and clk'event) thenif en='0' thenya<=bya;yb<=byb;yc<=byc;yd<=byd;moa<=bmoa;mob<=bmob;da<=bda

8、;db<=bdb;ha<=bha;hb<=bhb;ma<=bma;mb<=bmb;sa<=bsa;sb<=bsb;ms<=bms;elsems<=ms+'1'if ms="1001" thenms<="0000"if sb/="1001" thensb<=sb+'1'elsesb<="0000"if sa/="0101" thensa<=sa+'1'elsesa<=

9、"0000"if mb/="1001" thenmb<=mb+'1'elsemb<="0000"if ma/="0101" thenma<=ma+'1'elsema<="0000"if(hb/="1001") and (hb/="0011") or (ha/="0010") thenhb<=hb+'1'elsif hb="1001" the

10、nhb<="0000"ha<=ha+'1'elsif (hb="0011" and ha="0010") thenhb<="0000" ha<="0000"if(db/="1001") and (conv_integer(da)*10+conv_integer(db)/=hmd)thendb<=db+'1'elsif(conv_integer(da)*10+conv_integer(db)=hmd thenda&l

11、t;="0000" db<="0001"if(mob/="1001")and(mob/="0010")or(moa/="0001")thenmob<=mob+'1'elsif mob="1001" thenmob<="0000"moa<="0001"elsemob<="0001"moa<="0000"if(yd/="1001"

12、) thenyd<=ya+'1'elseyd<="0000"if(yc/="1001") thenyc<=yc+'1'elseyc<="0000"if(yb/="1001") thenyb<=yb+'1'elseyb<="0000"ya<=ya+'1'end if;end if;end if;end if;elsif db="1001" thendb<="

13、0000"da<=da+'1'end if;end if;end if;end if;end if;end if;elseend if;end if;elseend if;end process a1;a2:process(ya,yb,yc,yd)beginif(mob="0001")and(moa="0000")or(mob="0011")or(mob="0101")or(mob="0111")or(mob="1000")or(mob="0000")or(mob="0010"and moa="0001") thenhmd<=31;elsif mob="0010" thenif(yc="0000")and(

溫馨提示

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

評論

0/150

提交評論