根據(jù)VHDL的多功能數(shù)字鐘設(shè)計(jì)報(bào)告_第1頁(yè)
根據(jù)VHDL的多功能數(shù)字鐘設(shè)計(jì)報(bào)告_第2頁(yè)
根據(jù)VHDL的多功能數(shù)字鐘設(shè)計(jì)報(bào)告_第3頁(yè)
根據(jù)VHDL的多功能數(shù)字鐘設(shè)計(jì)報(bào)告_第4頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、根據(jù)vhdl的多功能數(shù)字鐘設(shè)計(jì)報(bào)告基于vhdl的多功能數(shù)字鐘設(shè)計(jì)報(bào)告021215班衛(wèi)時(shí)章02121451 一、設(shè)計(jì)要求 1、具有以二十四小時(shí)制計(jì)時(shí)、顯示、整點(diǎn)報(bào)時(shí)、時(shí)間設(shè)置和鬧鐘的功能。2、設(shè)計(jì)精度要求為1秒。二、設(shè)計(jì)環(huán)境:quartus ii三、系統(tǒng)功能描述1、系統(tǒng)輸入:時(shí)鐘信號(hào)clk采用50mhz;系統(tǒng)狀態(tài)及較時(shí)、定時(shí)轉(zhuǎn)換的控制信號(hào)為k、set,校時(shí)復(fù)位信號(hào)為reset,均由按鍵信號(hào)產(chǎn)生。2、系統(tǒng)輸出:led顯示輸出;蜂鳴器聲音信號(hào)輸出。3、多功能數(shù)字電子鐘系統(tǒng)功能的具體描述如下:(一)計(jì)時(shí):正常工作狀態(tài)下,每日按24h計(jì)時(shí)制計(jì)時(shí)并顯示,蜂鳴器無(wú)聲,逢整點(diǎn)報(bào)時(shí)。(二)校時(shí):在計(jì)時(shí)顯示狀態(tài)下

2、,按下“k”鍵,進(jìn)入“小時(shí)”待校準(zhǔn)狀態(tài),若此時(shí)按下“set”鍵,小時(shí)開始校準(zhǔn);之后按下“k”鍵則進(jìn)入“分”待校準(zhǔn)狀態(tài);繼續(xù)按下“k”鍵則進(jìn)入“秒”待復(fù)零狀態(tài);再次按下“k”鍵數(shù)碼管顯示鬧鐘時(shí)間,并進(jìn)入鬧鐘“小時(shí)”待校準(zhǔn)狀態(tài);再次按下“k”鍵則進(jìn)入鬧鐘“分”待校準(zhǔn)狀態(tài);若再按下“k”鍵恢復(fù)到正常計(jì)時(shí)顯示狀態(tài)。若校時(shí)過(guò)程中按下“reset”鍵,則系統(tǒng)恢復(fù)到正常計(jì)數(shù)狀態(tài)。(1)“小時(shí)”校準(zhǔn)狀態(tài):在“小時(shí)”校準(zhǔn)狀態(tài)下,顯示“小時(shí)”的數(shù)碼管以2hz 閃爍,并按下“set”鍵時(shí)以2hz的頻率遞增計(jì)數(shù)。(2)“分”校準(zhǔn)狀態(tài):在“分”校準(zhǔn)狀態(tài)下,顯示“分”的數(shù)碼管以2hz閃爍,并按下“set”鍵時(shí)以2hz的頻

3、率遞增計(jì)數(shù)。(3)“秒”校準(zhǔn)狀態(tài):在“秒復(fù)零”狀態(tài)下,顯示“秒”的數(shù)碼管以2hz閃爍,并以1hz的頻率遞增計(jì)數(shù)。(4)鬧鐘“小時(shí)”校準(zhǔn)狀態(tài):在鬧鐘“小時(shí)”校準(zhǔn)狀態(tài)下,顯示“小時(shí)”的數(shù)碼管以2hz閃爍,并按下“set”鍵時(shí)以2hz的頻率遞增計(jì)數(shù)。(5)鬧鐘“分”校準(zhǔn)狀態(tài):在鬧鐘“分”校準(zhǔn)狀態(tài)下,顯示“分”的數(shù)碼管以2hz閃爍,并按下“set”鍵時(shí)以2hz的頻率遞增計(jì)數(shù)。(三)整點(diǎn)報(bào)時(shí):蜂鳴器在“59”分鐘的第“51”、“53”、“55”、“57”秒發(fā)頻率為500hz的低音,在“59”分鐘的第“59”秒發(fā)頻率為1000hz的高音,結(jié)束時(shí)為整點(diǎn)。(四)顯示:采用掃描顯示方式驅(qū)動(dòng)4個(gè)led數(shù)碼管顯示小

4、時(shí)、分,秒由兩組led燈以4位bcd 碼顯示。(五)鬧鐘:鬧鐘定時(shí)時(shí)間到,蜂鳴器發(fā)出頻率為1000hz的高音,持續(xù)時(shí)間為60秒。四、各個(gè)模塊分析說(shuō)明1、分頻器模塊(freq.vhd)(1)模塊說(shuō)明:輸入一個(gè)頻率為50mhz的clk,利用計(jì)數(shù)器分出1khz的q1khz,500hz的q500hz,2hz的q2hz和1hz的q1hz。(2)源程序:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;entity freq isport (clk: in std_logic ; -輸入時(shí)鐘信號(hào)q1khz:

5、 buffer std_logic;q500hz: buffer std_logic;q2hz: buffer std_logic;q1hz: out std_logic);end freq;architecture bhv of freq isbeginp1khz:process(clk)variable cout:integer:=0;beginif clkevent and clk=1 thencout:=cout+1; -每來(lái)個(gè)時(shí)鐘上升沿時(shí)cout開始計(jì)數(shù)if coutelse cout:=0; -輸出“1”,完成1khz頻率輸出end if;end if;end process;p5

6、00hz:process(q1khz) -q1khz作為輸入信號(hào),分出q500hz variable cout:integer:=0;beginif q1khzevent and q1khz=1 thencout:=cout+1;if cout=1 then q500hzelsif cout=2 then cout:=0;q500hzend if;end if;end process;p2hz:process(q500hz)variable cout:integer:=0;beginif q500hzevent and q500hz=1 thencout:=cout+1;if coutelsi

7、f coutelse cout:=0; end if; end if;end process;p1hz:process(q2hz)variable cout:integer:=0;beginif q2hzevent and q2hz=1 thencout:=cout+1;if cout=1 then q1hzelsif cout=2 then cout:=0;q1hzend if;end if;end process;end bhv;(3)模塊圖:2、控制器模塊(contral.vhd)(1)模塊說(shuō)明:輸入端口k,set鍵來(lái)控制6個(gè)狀態(tài),這六個(gè)狀態(tài)分別是:顯示計(jì)時(shí)時(shí)間狀態(tài),調(diào)計(jì)時(shí)的時(shí)、分、秒的

8、3個(gè)狀態(tài),調(diào)鬧鈴的時(shí)、分的3個(gè)狀態(tài),reset鍵是復(fù)位鍵,用來(lái)回到顯示計(jì)時(shí)時(shí)間的狀態(tài)。(2)波形仿真圖:(3)模塊圖: 3、二選一模塊(mux21a.vhd)(1)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mux21a isport(a,b,s:in bit;y:out bit);end entity mux21a;architecture one of mux21a isbeginprocess(a,b,s)beginif s=0 thenyend if;end pr

9、ocess;end architecture one;(2)仿真波形圖:(3)模塊圖: 4、計(jì)時(shí)模塊 a.秒計(jì)時(shí)(second.vhd) (1)仿真波形圖:(2)模塊圖:b.分計(jì)時(shí)(minute.vhd) (1)仿真波形圖:(2)模塊圖:c.小時(shí)計(jì)時(shí)(hour.vhd) (1)仿真波形圖:(2)模塊圖: d.鬧鐘分計(jì)時(shí)(cntm60b.vhd) (1)仿真波形圖:(2)模塊圖:e.鬧鐘小時(shí)計(jì)時(shí)(cnth24b.vhd)(1)仿真波形圖:(2)模塊圖:5、鬧鐘比較模塊(compare.vhd)(1)模塊說(shuō)明:比較正常計(jì)數(shù)時(shí)間與鬧鐘定時(shí)時(shí)間是否相等,若相等,compout 輸出“1”,反之輸出“0

10、”。(2)仿真波形圖: (3)模塊圖: 6、報(bào)時(shí)模塊(bell.vhd)(1)模塊說(shuō)明:該模塊既實(shí)現(xiàn)了整點(diǎn)報(bào)時(shí)的功能,又實(shí)現(xiàn)了鬧鈴的功能,蜂鳴器通過(guò)所選頻率的不同,而發(fā)出不同的聲音。(2)仿真波形圖:(3)模塊圖:7、控制顯示模塊(show_con.vhd)(1)模塊說(shuō)明:該模塊實(shí)現(xiàn)了數(shù)碼管既可以顯示正常時(shí)間,又可以顯示鬧鐘時(shí)間的功能;調(diào)時(shí)過(guò)程的定時(shí)閃爍功能也在此模塊中真正實(shí)現(xiàn)。(2)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity show_con is port(th1,

11、tm1,ts1:in std_logic_vector(7 downto 4);th0,tm0,ts0:in std_logic_vector(3 downto 0);bh1,bm1:in std_logic_vector(7 downto 4);bh0,bm0:in std_logic_vector(3 downto 0);sec1,min1,h1: out std_logic_vector(7 downto 4);sec0,min0,h0: out std_logic_vector(3 downto 0);q2hz,flashs,flashh,flashm,sel_show:in std_

12、logic);end show_con;architecture rtl of show_con isbeginprocess(th1,tm1,ts1,th0,tm0,ts0,bh1,bm1,bh0,bm0,q2hz,flashs,flashh,flashm,sel_sho w)beginif sel_show=0thenif ( flashh=1and q2hz=1)thenh1min1sec1elsif (flashm=1and q2hz=1)thenh1min1sec1elsif (flashs=1and q2hz=1)thenh1min1sec1elseh1min1sec1end if

13、;elsif sel_show=1then-若sel_show為“1”,數(shù)碼管顯示鬧鐘時(shí)間if(flashh=1 and q2hz=1)thenh1min1sec1elsif ( flashm=1 and q2hz=1)thenh1min1sec1elseh1 min1sec1end if ; end if;end process;end rtl;(3)模塊圖:8、動(dòng)態(tài)掃描顯示模塊(scan_led.vhd)(1)模塊說(shuō)明:由4組輸入信號(hào)和輸出信號(hào)進(jìn)而實(shí)現(xiàn)了時(shí)鐘時(shí)、分的動(dòng)態(tài)顯示。(2)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.s

14、td_logic_unsigned.all;entity scan_led isport(clk1:in std_logic;h0:in std_logic_vector(3 downto 0);h1:in std_logic_vector(7 downto 4);min0:in std_logic_vector(3 downto 0);min1:in std_logic_vector(7 downto 4);ml:out std_logic_vector(7 downto 0);mh:out std_logic_vector(7 downto 0);hl:out std_logic_vect

15、or(7 downto 0);hh:out std_logic_vector(7 downto 0);end scan_led;architecture one of scan_led issignal cnt4:std_logic_vector(1 downto 0); signal a: std_logic_vector(3 downto 0) ; beginp1:process(clk1)beginif clk1event and clk1 =1 thencnt4if cnt4=3 thencnt4end if;end if;end process p1;p2:process(cnt4,h1,h0,min1,min0)begincase cnt4 is -控制數(shù)碼管位選when 00=case min0 iswhen 0000=mlwhen 0001=mlwhen 0010=mlwhen 0011=mlwhen 0100=mlwhen 0101=mlwhen 0110=mlwhen 0111=mlwhen 1000=mlwhen 100

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論