可編程邏輯器件電路設(shè)計(jì)課程設(shè)計(jì)報(bào)告多功能數(shù)字鐘的FPGA實(shí)現(xiàn)_第1頁(yè)
可編程邏輯器件電路設(shè)計(jì)課程設(shè)計(jì)報(bào)告多功能數(shù)字鐘的FPGA實(shí)現(xiàn)_第2頁(yè)
可編程邏輯器件電路設(shè)計(jì)課程設(shè)計(jì)報(bào)告多功能數(shù)字鐘的FPGA實(shí)現(xiàn)_第3頁(yè)
可編程邏輯器件電路設(shè)計(jì)課程設(shè)計(jì)報(bào)告多功能數(shù)字鐘的FPGA實(shí)現(xiàn)_第4頁(yè)
可編程邏輯器件電路設(shè)計(jì)課程設(shè)計(jì)報(bào)告多功能數(shù)字鐘的FPGA實(shí)現(xiàn)_第5頁(yè)
已閱讀5頁(yè),還剩35頁(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、可編程邏輯器件電路設(shè)計(jì)課程設(shè)計(jì)報(bào)告多功能數(shù)字鐘的fpga實(shí)現(xiàn)姓 名: 班 級(jí): 學(xué) 號(hào): 指導(dǎo)老師: 日期: 摘 要fpga( field programmable gate array,現(xiàn)場(chǎng)可編程門陣列),是20 世紀(jì)70 年代發(fā)展起來(lái)的一種可編程邏輯器件,是目前數(shù)字系統(tǒng)設(shè)計(jì)的主要硬件基礎(chǔ)??删幊踢壿嬈骷脑O(shè)計(jì)過(guò)程是利用eda 開(kāi)發(fā)軟件和編程和編程工具對(duì)器件進(jìn)行開(kāi)發(fā)的過(guò)程。本系統(tǒng)采用模塊化的設(shè)計(jì)方式,重復(fù)使用的功能模塊均以組件(component)的形式存在,一邊相關(guān)塊的調(diào)用,主程序內(nèi)用不同功能塊構(gòu)成一個(gè)完整的結(jié)構(gòu)。將所有的組件收集在同一個(gè)程序包my_pkg中。本設(shè)計(jì)主要使用了vhdl 語(yǔ)言

2、,采用的fpga 開(kāi)發(fā)平臺(tái)是maxplus2,而設(shè)計(jì)一個(gè)多功能數(shù)字鐘,在maxplus2 開(kāi)發(fā)平臺(tái)下進(jìn)行了編譯、仿真、下載,實(shí)現(xiàn)了基本計(jì)時(shí)顯示和設(shè)置、調(diào)整時(shí)間、報(bào)時(shí)和鬧鐘功能。 關(guān)鍵詞 fpga;模塊化;vhdl;maxplus2;數(shù)字鐘目 錄1設(shè)計(jì)任務(wù)及要求11.1 設(shè)計(jì)任務(wù)11.2 設(shè)計(jì)要求11.3 功能拓展12 方案比較與選擇23 底層文件仿真與分析33.1 1024分頻文件33.2 二選一數(shù)據(jù)選擇器33.3 60進(jìn)制計(jì)數(shù)器43.4 24進(jìn)制計(jì)數(shù)器43.5 十進(jìn)制轉(zhuǎn)bcd模塊53.6 bcd轉(zhuǎn)led顯示碼53.7 數(shù)碼管動(dòng)態(tài)掃描顯示模塊63.8 鬧鐘報(bào)警模塊64 頂層文件仿真與分析84.

3、1頂層時(shí)鐘設(shè)計(jì)輸入輸出圖元84.2 頂層文件仿真分析85硬件驗(yàn)證分析105.1 管腳分配105.2 硬件調(diào)試116課程設(shè)計(jì)心得12abstract13參考文獻(xiàn)附錄(源代碼)1設(shè)計(jì)任務(wù)及指標(biāo)1.1設(shè)計(jì)任務(wù)能進(jìn)行正常的時(shí)、分、秒計(jì)時(shí)功能,分別由6只數(shù)碼管顯示24小時(shí)、60分、60秒。按下試驗(yàn)箱上的某個(gè)按鍵時(shí),計(jì)時(shí)器迅速遞增,并按24小時(shí)循環(huán),計(jì)到23小時(shí)后再回到00。按下試驗(yàn)箱上的某個(gè)按鍵時(shí),計(jì)分器迅速遞增,并按60分循環(huán),計(jì)到59分后再回到00。利用試驗(yàn)箱上的揚(yáng)聲器可以實(shí)現(xiàn)整,當(dāng)計(jì)時(shí)到達(dá)59分50秒時(shí)開(kāi)始報(bào)時(shí),在59分50秒、52秒、54秒、56秒、58秒時(shí)鳴叫,鳴叫聲頻率為500hz,整點(diǎn)報(bào)時(shí)

4、頻率可定義為1khz.1.2設(shè)計(jì)要求運(yùn)用頂層設(shè)計(jì)思路設(shè)計(jì)好各個(gè)底層文件(vhdl代碼),對(duì)各個(gè)底層文件進(jìn)行功能仿真;采用原理圖或者文本方法來(lái)實(shí)現(xiàn)頂層文件的設(shè)計(jì),對(duì)頂層文件進(jìn)行功能真仿真。在頂層文件功能仿真正確之后,把頂層文件下載到實(shí)驗(yàn)箱的fpga里邊去,驗(yàn)證電路功能是否正確。具體時(shí)間用6位數(shù)碼管來(lái)顯示,具有整點(diǎn)報(bào)時(shí)功能1.3 功能拓展實(shí)現(xiàn)數(shù)字鐘的鬧鈴功能。2方案比較與選擇方案一:系統(tǒng)直接采用1hz脈沖作為作為時(shí)鐘輸入信號(hào)。數(shù)碼管采用靜態(tài)顯示。時(shí)間調(diào)整采用具有預(yù)置功能的計(jì)數(shù)器。報(bào)時(shí)為頻率512hz脈沖,并引入1024hz脈沖進(jìn)行整點(diǎn)報(bào)時(shí)。方案二:系統(tǒng)采用1024hz脈沖作為作為時(shí)鐘輸入信號(hào)。數(shù)碼

5、管采用動(dòng)態(tài)掃描顯示。時(shí)間調(diào)整采用一個(gè)數(shù)據(jù)選擇器,以一個(gè)按鍵作為控制端。當(dāng)調(diào)整按鍵按下時(shí),選擇比較高的頻率作為計(jì)數(shù)器計(jì)數(shù)信號(hào)作為輸入信號(hào),加快計(jì)數(shù)的速度,以此達(dá)到時(shí)間調(diào)整的效果。clkkey0key1key21024分頻128分頻秒計(jì)數(shù)分計(jì)數(shù)時(shí)計(jì)數(shù)二選一二選一二選一與門非門非門與門圖一 方案二時(shí)鐘流程方案比較:對(duì)于方案一,因?yàn)橄到y(tǒng)需要1024hz和512hz的脈沖驅(qū)動(dòng)蜂鳴器,并且在快速調(diào)整時(shí)間是也需要比1hz快的脈沖,故需要采用另外的脈沖輸入,增加管腳資源開(kāi)支和外部資源。實(shí)現(xiàn)具有預(yù)置功能的計(jì)數(shù)器比較復(fù)雜,并且預(yù)置輸入端需要多個(gè)端口。數(shù)碼管采用靜態(tài)顯示也會(huì)增加管腳的開(kāi)銷。對(duì)于方案二,因?yàn)椴捎?02

6、4hz的脈沖,能夠通過(guò)分頻得到多種頻率的脈沖,因而可以實(shí)現(xiàn)單一脈沖信號(hào)輸入即可完成快速調(diào)整時(shí)間和采用數(shù)碼管動(dòng)態(tài)掃描顯示,節(jié)省管腳資源和外部資源。綜上所述,故采用方案二。3底層文件仿真與分析3.1 1024分頻文件整個(gè)系統(tǒng)采用1024hz的頻率,由此文件產(chǎn)生1hz頻率,作為秒信號(hào)。此文件的圖元及仿真波形如下圖所示。同理亦可以產(chǎn)生4hz頻率,512hz頻率。圖二 1024分頻文件圖元圖三 仿真波形如圖二所示,輸入1024hz的頻率,輸出信號(hào)頻率為1hz。3.2二選一數(shù)據(jù)選擇器圖四 數(shù)據(jù)選擇器圖元圖五 數(shù)據(jù)選擇器仿真波形圖3.3 60進(jìn)制計(jì)數(shù)器由此模塊對(duì)秒或分信號(hào)進(jìn)行分頻,產(chǎn)生分和小時(shí)信號(hào)。圖六 6

7、0進(jìn)制計(jì)數(shù)器圖元圖七 60進(jìn)制計(jì)數(shù)器仿真波形圖3.4 24進(jìn)制計(jì)數(shù)器由此模塊對(duì)小時(shí)信號(hào)進(jìn)行分頻,產(chǎn)生日周期。圖八 24進(jìn)制計(jì)數(shù)器圖元圖九 24進(jìn)制計(jì)數(shù)器仿真波形圖3.5 十進(jìn)制轉(zhuǎn)bcd模塊由于有計(jì)數(shù)器產(chǎn)生的信號(hào)為十進(jìn)制,所以要由此模塊轉(zhuǎn)化成bcd碼。圖十 十進(jìn)制轉(zhuǎn)bcd模塊圖元圖十一 十進(jìn)制轉(zhuǎn)bcd模塊仿真波形圖3.6 bcd轉(zhuǎn)led顯示碼因?yàn)橄到y(tǒng)采用七段數(shù)碼管顯示,所以要將bcd碼轉(zhuǎn)換成七段數(shù)碼管相應(yīng)的顯示的七位碼值。圖十二 bcd轉(zhuǎn)led顯示碼圖元圖十三 bcd轉(zhuǎn)led顯示碼仿真波形圖3.7 數(shù)碼管掃描動(dòng)態(tài)顯示模塊為了節(jié)省管腳資源,外置一片74ls138譯碼芯片,采用六位動(dòng)態(tài)數(shù)碼管顯示。如

8、圖十三所示,mux_out為數(shù)碼管的段選,s為位選,作為74ls138譯碼芯片的3位輸入信號(hào)。a,b,c,d,e,f分別為時(shí)分秒計(jì)數(shù)器的輸入端口。掃描原理是在時(shí)鐘控制下,輪流對(duì)a到f的輸入信號(hào)分別在對(duì)應(yīng)的一位數(shù)碼管顯示其值,利用人體視覺(jué)暫留效應(yīng),同時(shí)顯示6位值。圖十四 數(shù)碼管掃描動(dòng)態(tài)顯示模塊圖元圖十五 數(shù)碼管掃描動(dòng)態(tài)顯示模塊仿真波形3.8 鬧鐘報(bào)警模塊如圖十五所示,此模塊有正常計(jì)時(shí)的時(shí)分秒輸入和鬧鐘預(yù)置時(shí)分秒輸入,當(dāng)兩者相同時(shí),這輸出報(bào)警信號(hào)。圖十六 鬧鐘報(bào)警模塊圖元圖十七 鬧鐘報(bào)警模塊仿真波形4頂層文件仿真與分析4.1 頂層時(shí)鐘設(shè)計(jì)輸入輸出圖元 如下圖:圖十八 頂層文件圖元4.2 頂層文件仿

9、真分析 如下圖所示,整個(gè)系統(tǒng)需用23個(gè)管腳。clk為系統(tǒng)時(shí)鐘輸入信號(hào)端口。rst為復(fù)位信號(hào)輸入端口,高電平有效。key0,key1,yey2分別為秒、分、小時(shí)調(diào)整輸入端口。al_key0,al_key1,al_key2分別為鬧鐘的秒,分,小時(shí)預(yù)置輸入端口。speak為整點(diǎn)報(bào)時(shí)輸出端口。a_out為鬧鐘報(bào)警輸出信號(hào)端口。a_shift為正常計(jì)時(shí)與鬧鐘預(yù)置切換信號(hào)輸入。a_en為鬧鐘時(shí)能信號(hào)輸入端口。seg4為數(shù)碼管段選輸出端口,s為作為74ls138輸入信號(hào)的數(shù)碼管位選輸出信號(hào)。圖十九 頂層原件框圖圖二十 頂層文件仿真波形5硬件驗(yàn)證分析5.1 管腳分配表1 多功能數(shù)字鐘的fpga管腳分配node

10、 namedirectionlocational_key0inputpin=24al_key1inputpin=25al_key2inputpin=27clkinputpin=84eninputpin=35key0inputpin=21key1inputpin=22key2inputpin=23rstinputpin=29shiftinputpin=30outoutputpin=17seg40outputpin=5seg41outputpin=6seg42outputpin=7seg43outputpin=8seg44outputpin=9seg45outputpin=10seg46outpu

11、tpin=11speakoutputpin=19s00outputpin=78s01outputpin=79s02outputpin=80在各個(gè)子模塊以及頂層模塊編譯成功后,需要下載到fpga中進(jìn)行調(diào)試或?qū)崿F(xiàn),下載之前需要對(duì)程序所用的輸入輸出端口進(jìn)行分配。查詢了實(shí)驗(yàn)箱上的fpga 的管腳分配,對(duì)各個(gè)端口進(jìn)行關(guān)聯(lián)。5.2 硬件調(diào)試 各個(gè)程序都在編譯器maxplus2 中正常的編輯,在管腳分配以后,連接好實(shí)驗(yàn)箱,將編譯過(guò)的程序下載到實(shí)驗(yàn)箱的fpga上,調(diào)試每一個(gè)輸入端口的控制,驗(yàn)證輸出結(jié)果是否與預(yù)想中的一致。如果不一致就修改程序。然后再進(jìn)行編譯下載調(diào)試。直到實(shí)現(xiàn)所有功能位置??傇O(shè)計(jì)調(diào)試流程如下:

12、文本輸入層次化設(shè)計(jì)編 譯是否正確?確?管 腳 分 配重 新 編 譯時(shí)序仿真正確形 成 下 載 文 件硬件測(cè)試修改nono結(jié)束是否正確?no圖二十一 總體設(shè)計(jì)調(diào)試圖6課程設(shè)計(jì)心得本次設(shè)計(jì)我們小組選的題目是多功能數(shù)字鐘的fpga實(shí)現(xiàn) ;在確立這個(gè)題目之前,我們借閱了相關(guān)的書籍,結(jié)合了小組自身的情況選擇了這個(gè)課題。確定課題后,我們進(jìn)行組內(nèi)分工。發(fā)揮各人特長(zhǎng),根據(jù)程序編寫,程序調(diào)試,報(bào)告撰寫的工作量,合理的分配了相應(yīng)的工作。在模塊設(shè)立的明細(xì)下,程序的初步編寫還是挺簡(jiǎn)單的,然而,對(duì)每個(gè)子模塊的編譯過(guò)程,還是會(huì)出現(xiàn)一些錯(cuò)誤,比如,定義的端口沒(méi)有給信號(hào);定義好的器件代碼,沒(méi)有放到程序包中進(jìn)行例化。在完善代碼

13、的過(guò)程當(dāng)中,我們更加熟悉了vhdl代碼的開(kāi)發(fā)流程,以及相應(yīng)的開(kāi)發(fā)形式。在調(diào)試的過(guò)程中,還是發(fā)現(xiàn)挺多問(wèn)題的。發(fā)現(xiàn)時(shí)鐘調(diào)時(shí)和秒鐘調(diào)時(shí),相互重疊,于是我們檢查了源代碼,發(fā)現(xiàn)在信號(hào)的傳送過(guò)程,向端口賦予了錯(cuò)誤的信號(hào)。發(fā)現(xiàn)在秒鐘、分鐘的調(diào)時(shí)設(shè)置時(shí),會(huì)產(chǎn)生進(jìn)位信號(hào),于是又想著增加一個(gè)與門,當(dāng)有調(diào)時(shí)信號(hào)(高有效)時(shí),經(jīng)過(guò)非門到達(dá)與門,則此時(shí)停止對(duì)高位的計(jì)時(shí)。經(jīng)過(guò)多次的修改,達(dá)到了要求實(shí)現(xiàn)的效果。于是我們自己設(shè)置了新的功能鬧鐘。在完成這個(gè)設(shè)計(jì)的過(guò)程中,我們學(xué)到了很多,整個(gè)過(guò)程都是對(duì)這個(gè)學(xué)期eda課程學(xué)習(xí)的進(jìn)階。在遇到問(wèn)題的時(shí)候,我們學(xué)會(huì)了,針對(duì)性的找打相應(yīng)的問(wèn)題所在,即全面性的解決問(wèn)題。通過(guò)這次課程設(shè)計(jì),提高

14、了動(dòng)手能力和科學(xué)嚴(yán)謹(jǐn)?shù)木?,其次是加?qiáng)了與他人交流合作的能力,在設(shè)計(jì)過(guò)程中遇到許多問(wèn)題,通過(guò)獨(dú)立思考,查找資料,和同學(xué)交流等方式攻克了難題。在設(shè)計(jì)中對(duì)總體設(shè)計(jì)思路有了全面的框架,避免了編程時(shí)遇到低級(jí)錯(cuò)誤。總的來(lái)說(shuō),這次課程設(shè)計(jì)確實(shí)學(xué)到很多,也鍛煉了遇到問(wèn)題解決問(wèn)題的勇氣和能力,以及遇到挫折不達(dá)目的不罷休的韌性,這在以后的工作與學(xué)習(xí)中將會(huì)非常重要。the realization of multi-function digital clockbased on fpga(college of engineering and college of public management, south ch

15、ina agricultural university guangzhou 510642,china)abstractfpga( field programmable gate array) is a kind of programmable logic devices has developed since the 1970s, and it is the main hardware foundation of presently design digital system.the design process of programmable logic device is a proces

16、s using the development software, eda, and programming tools to develop the device.our system uses the modular design way. the function modules which were used more than once exist in components. some related block are called in the main program. the main program uses different function blocks insid

17、e, and constitutes a complete structure. what is more, we collect all components in the same package, my_pkg.our design is a multi-function digital clock, which mainly uses the vhdl language, maxplus2 as the development platform of fpga. we compiled, simulated and downloaded in the development platf

18、orm of maxplus2. finally we achieved the functions, such as basic timer display and settings, adjusting, alarming.key words: fpga; modular design ; vhdl; maxplus2; digital clock參考文獻(xiàn)1.潘松,黃繼業(yè).eda技術(shù)實(shí)用教程.科學(xué)出版社.2006.09.2.林明權(quán).vhdl數(shù)字控制系統(tǒng)設(shè)計(jì)范例.電子工業(yè)出版社.2003.01:84114.附錄(源代碼)1. 1hz頻率時(shí)鐘脈沖library ieee;use ieee.st

19、d_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity div1024 is -實(shí)現(xiàn)1024分頻,產(chǎn)生1hz時(shí)鐘脈沖 port( clk: in std_logic; -輸入信號(hào)頻率1024hz f1hz: out std_logic); -輸出1hz頻率end div1024;architecture behav of div1024 is signal count : integer range 0 to 1023;beginprocess (clk)begin if risi

20、ng_edge(clk) then count=1023 then f1hz=1; else f1hz=0; end if; end if;end process;end behav;2. 4hz頻率時(shí)鐘脈沖library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity div128 is -實(shí)現(xiàn)128分頻,產(chǎn)生4hz時(shí)鐘脈沖 port( clk: in std_logic; -輸入信號(hào)頻率1024hz f1hz: out std_logic

21、); -輸出4hz頻率end div128;architecture behav of div128 is signal count : integer range 0 to 127;beginprocess (clk)begin if rising_edge(clk) then count=127 then f1hz=1; else f1hz=0; end if; end if;end process;end behav;3.512hz頻率時(shí)鐘脈沖library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

22、use ieee.std_logic_arith.all;entity div2 is-實(shí)現(xiàn)2分頻,產(chǎn)生512hz時(shí)鐘脈沖 port( clk: in std_logic; -輸入信號(hào)頻率1024hz f1hz: out std_logic); -輸出1hz頻率end div2;architecture behav of div2 is signal count : integer range 0 to 1;beginprocess (clk)begin if rising_edge(clk) then count=1 then f1hz=1; else f1hz=0; end if; end

23、 if;end process;end behav;4.二選一選擇器library ieee;use ieee.std_logic_1164.all;entity mux21 is-二選一選擇器port(a,b : in std_logic; s : in std_logic; y : out std_logic);end;architecture behav of mux21 isbegin y=a when s=0 else b;end behav;5.非門電路library ieee;use ieee.std_logic_1164.all;entity spnot is -非門電路por

24、t(clk : in std_logic; a : in std_logic; c : out std_logic);end;architecture behav of spnot isbeginprocess(clk)beginc=not a ;end process;end behav;6.二輸入與門library ieee;use ieee.std_logic_1164.all;entity spand2 is -二輸入與門port(clk : in std_logic;a,b : in std_logic;c : out std_logic);end;architecture beha

25、v of spand2 isbeginprocess(clk)beginc=a and b;end process;end behav;760進(jìn)制計(jì)數(shù)器library ieee;use ieee.std_logic_1164.all;entity count60 is-60進(jìn)制計(jì)數(shù)器 port(carry: in std_logic; -計(jì)數(shù)脈沖輸入端口 rst: in std_logic;-復(fù)位端口 times: out integer range 0 to 59; full: out std_logic);-進(jìn)位端口end count60;architecture behav of cou

26、nt60 is signal time : integer range 0 to 59;begin process (rst,carry) begin if rst=1 then time = 0; full=0; elsif rising_edge(carry) then if time=59 then time=0;-60進(jìn)制判斷 full=1; -進(jìn)位信號(hào) else time= time + 1; -保持計(jì)數(shù) full=0; end if; end if; end process; times=time;end behav;8. 24進(jìn)位計(jì)數(shù)器library ieee;use ieee.

27、std_logic_1164.all;entity count24 is-24進(jìn)制計(jì)數(shù)器 port(carry: in std_logic; -計(jì)數(shù)脈沖信號(hào)輸入端口 rst: in std_logic; -復(fù)位 times: out integer range 0 to 23; full: out std_logic);-進(jìn)位信號(hào)端口end count24;architecture behav of count24 is signal time : integer range 0 to 23;begin process (rst,carry) begin if rst=1 then time

28、= 0; full=0; elsif rising_edge(carry) then if time=23 then time=0; full=1; else time= time + 1; full=0; end if; end if; end process; times one one one one one one one one one one one ten ten ten ten ten ten ten one one one one one one one one one one one ten ten ten ten ten ten ten one=0000;ten one=

29、0001;ten one=0010;ten one=0011;ten one=0100;ten one=0101;ten one=0110;ten one=0111;ten one=1000;ten one=1001;ten one=0000;ten one=0001;ten one=0010;ten one=0011;ten one=0100;ten one=0101;ten one=0110;ten one=0111;ten one=1000;ten one=1001;ten one=0000;ten one=0001;ten one=0010;ten one=0011;ten one=0

30、000;ten one=0001;ten one=0010;ten one=0011;ten one=0100;ten one=0101;ten one=0110;ten one=0111;ten one=1000;ten one=1001;ten one=0000;ten one=0001;ten one=0010;ten one=0011;ten one=0100;ten one=0101;ten one=0110;ten one=0111;ten one=1000;ten one=1001;ten one=0000;ten one=0001;ten one=0010;ten one=00

31、11;ten=0010;end case; end if;end process;end behav; 11. bcd轉(zhuǎn)led顯示碼library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity bin2led is-*二進(jìn)制轉(zhuǎn)十進(jìn)制數(shù)碼管輸出 port (bin : in std_logic_vector (3 downto 0); -待顯示的十進(jìn)制數(shù)的二進(jìn)制碼 led : out std_logic_vector (6 downto 0)

32、 ); -待顯示的十進(jìn)制數(shù)的7段數(shù)碼管對(duì)應(yīng)碼值end bin2led;architecture behav of bin2led isbegin with bin select led=0000110 when 0001,-數(shù)碼管顯示1 1011011 when 0010,-數(shù)碼管顯示21001111 when 0011, -數(shù)碼管顯示31100110 when 0100, -數(shù)碼管顯示41101101 when 0101, -數(shù)碼管顯示51111101 when 0110, -數(shù)碼管顯示60000111 when 0111, -數(shù)碼管顯示71111111 when 1000, -數(shù)碼管顯示8

33、1101111 when 1001, -數(shù)碼管顯示90111111 when 0000, -數(shù)碼管顯示0 0000000 when others;end behav;12. 數(shù)碼管動(dòng)態(tài)掃描顯示模塊library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity scan6 is-設(shè)置6位數(shù)碼管掃描顯示 port (rst,clk : in std_logic; a,b,c,d,e,f: in std_logic_vector(6 downto 0); s : out std_logic_vector(

34、2 downto 0); mux_out: out std_logic_vector(6 downto 0);end scan6;architecture behav of scan6 is signal sel : std_logic_vector(2 downto 0);begin process (rst,clk,a, b, c, d,e,f) begin if rst=1 then sel=000; elsif rising_edge(clk) then sel mux_out = a; s mux_out = b; s mux_out = 1000000; s mux_out = c

35、; s mux_out = d; s mux_out = 1000000; s mux_out = e; s mux_out = f; s mux_out = 0000000; end case; end if; end process;end behav;13.報(bào)時(shí)電路library ieee;use ieee.std_logic_1164.all;entity time_tell is -報(bào)時(shí)電路port( rst,clk : in std_logic;sec_in,min_in : in integer range 0 to 59; outs,outand : out std_logic

36、);end;architecture behav of time_tell isbeginprocess(clk,rst)beginif rst = 1 then outs=1; outand=0;elsif min_in = 00 and sec_in = 00 then outs=0; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand outs=1; outand null; end case; - 當(dāng)分鐘為5

溫馨提示

  • 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)論