久久99精品久久久久久琪琪,久久人人爽人人爽人人片亞洲,熟妇人妻无码中文字幕,亚洲精品无码久久久久久久

EDA實(shí)現(xiàn)多功能數(shù)字鐘

時(shí)間:2019-05-12 07:07:02下載本文作者:會(huì)員上傳
簡(jiǎn)介:寫(xiě)寫(xiě)幫文庫(kù)小編為你整理了多篇相關(guān)的《EDA實(shí)現(xiàn)多功能數(shù)字鐘》,但愿對(duì)你工作學(xué)習(xí)有幫助,當(dāng)然你在寫(xiě)寫(xiě)幫文庫(kù)還可以找到更多《EDA實(shí)現(xiàn)多功能數(shù)字鐘》。

第一篇:EDA實(shí)現(xiàn)多功能數(shù)字鐘

EDA實(shí)現(xiàn)多功能數(shù)字鐘

實(shí)

驗(yàn) 報(bào) 告

專(zhuān)業(yè)班級(jí):

學(xué)生姓名:

學(xué)生學(xué)號(hào):

目錄

一、內(nèi)容摘要

二、實(shí)驗(yàn)要求

三、各底層模塊設(shè)計(jì)

四、總體方案

五、心得體會(huì)

一、實(shí)驗(yàn)內(nèi)容

利用 QuartusII 軟件,結(jié)合所學(xué)的數(shù)字電路的知識(shí)設(shè)計(jì)一個(gè) 24 時(shí)多功能數(shù) 字鐘,具有正常分、秒計(jì)時(shí),動(dòng)態(tài)顯示的功能。分析整個(gè)電路的工作原理,分別說(shuō)明各子模塊的設(shè)計(jì)原理和調(diào)試、仿真、編 程的過(guò)程。

二、實(shí)驗(yàn)任務(wù):

用 FPGA 器件和 EDA 技術(shù)實(shí)現(xiàn)多功能數(shù)字鐘的設(shè)計(jì)

已知條件:

1、MAX+Plus 軟件

2、FPGA 實(shí)驗(yàn)開(kāi)發(fā)裝置

基本功能:

1、以數(shù)字形式顯示時(shí)、分、秒的時(shí)間;

2、小時(shí)計(jì)數(shù)器為 24 進(jìn)制;

3、分、秒計(jì)數(shù)器為 60 進(jìn)制。

三、底層模塊設(shè)計(jì)(電路原理圖及仿真)

1、小時(shí)計(jì)數(shù)器為24進(jìn)制 電路原理圖

仿真圖

封裝圖

2、分、秒計(jì)時(shí)器都為60進(jìn)制 電路原理圖

仿真圖

封裝圖

四、總體方案

按照上述實(shí)驗(yàn)要求,本次電子數(shù)字時(shí)鐘實(shí)驗(yàn),通過(guò)兩個(gè)模 60 計(jì)數(shù)器及一個(gè)模 24 計(jì)數(shù)器級(jí)聯(lián)既可以實(shí)現(xiàn)計(jì)時(shí)模塊。多功能數(shù)字鐘的主體部分 電路原理圖

仿真圖

封裝圖

五、心得體會(huì)

剛剛開(kāi)始覺(jué)得做這個(gè)電子實(shí)驗(yàn)報(bào)告挺難的,因?yàn)閷?duì)軟件的不熟悉和對(duì)這個(gè)實(shí)驗(yàn)操作的也不熟悉,對(duì)著老師給的資料也做了很長(zhǎng)時(shí)間,就是仿真的時(shí)候有些該注意的沒(méi)有注意,導(dǎo)致仿真失敗,但是后來(lái)還是自己慢慢拿的請(qǐng)教同學(xué)、老師哪里出了問(wèn)題,后來(lái)才做出來(lái)了,把60進(jìn)制的做出來(lái)了,后來(lái)的24進(jìn)制按照老師給的電路原理圖也成功了仿真出來(lái),我用了很長(zhǎng)時(shí)間才編寫(xiě)出來(lái),現(xiàn)在看看,也沒(méi)有那么難了。同時(shí)請(qǐng)教老師,和同學(xué)、通過(guò)實(shí)驗(yàn)掌握一些邏輯組合器件的基本功能和用法。總之,我很感謝這次實(shí)驗(yàn)可以給我這樣的機(jī)會(huì),這個(gè)實(shí)驗(yàn)給了我很對(duì)的收獲,我相信這會(huì)對(duì)我以后的學(xué)習(xí)很有幫助。

第二篇:eda 實(shí)現(xiàn)多功能數(shù)字鐘

一、標(biāo)題:EDA實(shí)現(xiàn)多功能數(shù)字鐘

二、任務(wù)書(shū):設(shè)計(jì)要求是用FPGA器件和EDA技術(shù)實(shí)現(xiàn)多功能數(shù)字鐘的設(shè)計(jì),⑴ 控制功能包括①以數(shù)字形式顯示時(shí)、分、秒的時(shí)間;②小時(shí)計(jì)數(shù)器為24進(jìn)制;③分、秒計(jì)數(shù)器為60進(jìn)制;④有兩個(gè)使能端起到校時(shí)、校分的作用,同時(shí)按無(wú)效;⑤每小時(shí)的59分51、53、55、57、59分別以四長(zhǎng)聲一短聲進(jìn)行模擬電臺(tái)仿真;⑥讓信號(hào)燈在晚上19點(diǎn)至早上5點(diǎn)亮;⑵ 在Max+plusⅡ軟件系統(tǒng)平臺(tái)上建立多功能數(shù)字鐘電路的頂層電路文件并完成編譯和仿真,并對(duì)器件進(jìn)行下載檢查。

三、關(guān)鍵詞:數(shù)字鐘 原理電路 編譯 仿真 下載

四、數(shù)字鐘電路系統(tǒng)的組成框圖:

五、各功能模塊設(shè)計(jì)、仿真波形及其分析說(shuō)明:

1、小時(shí)計(jì)時(shí)模塊:

仿真波形:

分析說(shuō)明:

當(dāng)小時(shí)的高四位為0、1時(shí),小時(shí)的低四位為九時(shí),在下一個(gè)時(shí)鐘的上跳延來(lái)了之后,高四位加一;當(dāng)小時(shí)的高四位為2,同時(shí)低四位為3時(shí),小時(shí)的高低四位都清零。實(shí)現(xiàn)從00到23的循環(huán)計(jì)數(shù)。

2、分鐘計(jì)時(shí)模塊:

仿真波形:

分析說(shuō)明:

當(dāng)分鐘的高四位為0、1、2、3、4時(shí),小時(shí)的低四位為九時(shí),在下一個(gè)時(shí)鐘的上跳延來(lái)了之后,高四位加一;當(dāng)分鐘的高四位為5時(shí),同時(shí)低四位為9時(shí),分鐘的高低四位都清零,實(shí)現(xiàn)從00到59的循環(huán)計(jì)數(shù)。

3、秒計(jì)時(shí)模塊(與分計(jì)時(shí)模塊相同);

4、校時(shí)、校分模塊:

仿真波形:

分析說(shuō)明:

SWM、SWH兩開(kāi)關(guān)先設(shè)置1,秒時(shí)鐘,分時(shí)鐘,小時(shí)時(shí)鐘分別設(shè)置為不同頻率的時(shí)鐘,當(dāng)開(kāi)關(guān)SWM置0即按下時(shí),秒時(shí)鐘CPS對(duì)分鐘進(jìn)行校對(duì),即如圖所示CPM在SWM為0時(shí)頻率與CPS相同;同理,當(dāng)SWH為0時(shí)用秒時(shí)鐘對(duì)小時(shí)進(jìn)行校對(duì),即CPH在SWH為0時(shí)頻率與CPS相同。當(dāng)SWM、SWH都不為0時(shí),分鐘、小時(shí)正常計(jì)時(shí)。

5、整點(diǎn)報(bào)時(shí)模塊:

仿真波形:

分析說(shuō)明:

為實(shí)現(xiàn)時(shí)鐘在59分51秒53秒55秒57秒時(shí),以低音報(bào)時(shí),當(dāng)為59分59秒時(shí)以高音報(bào)時(shí);所以將M[7..0]從高位到低位設(shè)置為0101 1001轉(zhuǎn)換成十進(jìn)制即為59分,秒的十位都為5所以S7到S4設(shè)置為0101,秒的個(gè)位1、3、5、7、9,即0001、0011、0101、0111、1001,從S3到S0只有當(dāng)S3設(shè)置為1的時(shí)候秒個(gè)位為9,通過(guò)分頻以1000HZ輸出以實(shí)現(xiàn)高音報(bào)時(shí);1、3、5、7時(shí)S0都為0,為能同時(shí)確定1、3、5、7則將S0設(shè)置為0,S1、S2則為任意。如波形所示,S3取一段設(shè)置為1時(shí),輸出FU變?yōu)?000HZ的高頻報(bào)時(shí),其余狀態(tài)一致為500HZ低頻報(bào)時(shí),從而實(shí)現(xiàn)預(yù)期情況。

6、時(shí)段控制模塊:

仿真波形:

分析說(shuō)明:

從19點(diǎn)到凌晨5點(diǎn)(含5點(diǎn)),燈亮,即完成時(shí)段控制。

六、頂層邏輯電路圖、仿真波形及分析結(jié)論:

建立一個(gè)頂層文件如圖:

仿真波形如下:

分析結(jié)論:

經(jīng)仿真波形分析①走時(shí)正常;②能〝校時(shí)〞〝校分〞;③整點(diǎn)報(bào)時(shí);④時(shí)段控制到位。功能完全符合設(shè)計(jì)要求,可以下載。

七、定義芯片管腳號(hào)(列表示意)及下載過(guò)程:

1、由于提供的實(shí)驗(yàn)箱的七段顯示器是掃描形式工作,需要進(jìn)行譯碼以及選擇掃描,需添加模塊:

該模塊有三部分組成,包括一個(gè)8進(jìn)制計(jì)數(shù)器,一個(gè)3-8數(shù)據(jù)選擇器及七段顯示譯碼器:

將該模塊連入最后的頂層文件中,即可進(jìn)行下載工作。

2、按鍵掃描模塊:由于試驗(yàn)箱提供的按鍵系統(tǒng)為4*4掃描矩陣,需將橫向或縱向按鍵設(shè)置0或1,該模塊只需要在頂層文件中接4個(gè)output出來(lái)接地,如圖:

3、分配輸入、輸出信號(hào)在器件上的引腳號(hào):

4、引腳分配表:

5、對(duì)器件進(jìn)行下載:

選MAX+plus II/Programmer,彈出編程對(duì)話框,如圖:

檢查編程文件名和器件,正確,接上硬件后,點(diǎn)擊器件編程。即完成下載。

八、課程設(shè)計(jì)中遇到問(wèn)題及解決方法

Q1:下載后,秒鐘不進(jìn)位

A:檢查原理電路發(fā)現(xiàn)輸入輸出接錯(cuò)位,經(jīng)更正正常; Q2:到59分51秒等不鬧鐘

A:檢查蜂鳴器是否接錯(cuò)管腳,下載器上套線是否接好,最后發(fā)現(xiàn)是套線的問(wèn)題,解決后,正常鳴叫。

九、課程設(shè)計(jì)項(xiàng)目最終結(jié)論

通過(guò)各模塊級(jí)聯(lián)最后成功下載,實(shí)現(xiàn)了兩個(gè)使能對(duì)分秒校時(shí),整點(diǎn)仿電臺(tái)報(bào)時(shí)以及時(shí)段控制的多功能數(shù)字鐘。

十、心得體會(huì):

實(shí)驗(yàn)過(guò)程中最然遇到了很多困難,從畫(huà)圖到理解電路圖,還有接觸沒(méi)有接觸過(guò)的下載,把紙上的東西用到了硬件中,質(zhì)的改變。看到成功的數(shù)字鐘,很有成就感。好像聽(tīng)到的蜂鳴聲是從未聽(tīng)到過(guò)的美妙樂(lè)曲。課設(shè)給我們指引了又一工作方向,培養(yǎng)對(duì)這些的興趣,對(duì)以后工作應(yīng)該很有幫助,所以堅(jiān)定了我課后還要多看書(shū)多學(xué)習(xí)這方面知識(shí)的信念。

十一、參閱教材及文獻(xiàn):

《電子線路實(shí)驗(yàn)設(shè)計(jì)仿真講義》

按鈕,直接對(duì)

第三篇:EDA課程設(shè)計(jì)——多功能數(shù)字鐘

哈爾濱工業(yè)大學(xué)(威海)電子學(xué)課程設(shè)計(jì)報(bào)告

帶有整點(diǎn)報(bào)時(shí)的數(shù)字鐘設(shè)計(jì)與制作

姓名: 蔣棟棟 班級(jí): 0802503 學(xué)號(hào): 080250331 指導(dǎo)教師:

井巖

目錄

一、課程設(shè)計(jì)的性質(zhì)、目的和任務(wù)????????????3

二、課程設(shè)計(jì)基本要求?????????????????3

三、設(shè)計(jì)課題要求???????????????????3

四、課程設(shè)計(jì)所需要儀器????????????????4

五、設(shè)計(jì)步驟?????????????????????4

1、整體設(shè)計(jì)框圖???????????????????4

2、各個(gè)模塊的設(shè)計(jì)與仿真???????????????4

2.1分頻模塊???????????????????????4

2.2計(jì)數(shù)器模塊??????????????????????6

2.3控制模塊??????????????????????10

2.4數(shù)碼管分配?????????????????????13

2.5顯示模塊??????????????????????14

2.6報(bào)時(shí)模塊??????????????????????16

六、調(diào)試中遇到的問(wèn)題及解決的方法???????????18

七、心得體會(huì)?????????????????????18

一、課程設(shè)計(jì)的性質(zhì)、目的和任務(wù)

創(chuàng)新精神和實(shí)踐能力二者之中,實(shí)踐能力是基礎(chǔ)和根本。這是由于創(chuàng)新基于實(shí)踐、源于實(shí)踐,實(shí)踐出真知,實(shí)踐檢驗(yàn)真理。實(shí)踐活動(dòng)是創(chuàng)新的源泉,也是人才成長(zhǎng)的必由之路。

通過(guò)課程設(shè)計(jì)的鍛煉,要求學(xué)生掌握電路的一般設(shè)計(jì)方法,具備初步的獨(dú)立設(shè)計(jì)能力,提高綜合運(yùn)用所學(xué)的理論知識(shí)獨(dú)立分析和解決問(wèn)題的能力,培養(yǎng)學(xué)生的創(chuàng)新精神。

二、課程設(shè)計(jì)基本要求

掌握現(xiàn)代大規(guī)模集成數(shù)字邏輯電路的應(yīng)用設(shè)計(jì)方法,進(jìn)一步掌握電子儀器的正確使用方法,以及掌握利用計(jì)算機(jī)進(jìn)行電子設(shè)計(jì)自動(dòng)化(EDA)的基本方法。

三、設(shè)計(jì)課題要求

(1)構(gòu)造一個(gè)24小時(shí)制的數(shù)字鐘。要求能顯示時(shí)、分、秒。(2)要求時(shí)、分、秒能各自獨(dú)立的進(jìn)行調(diào)整。

(3)能利用喇叭作整點(diǎn)報(bào)時(shí)。從59分50秒時(shí)開(kāi)始報(bào)時(shí),每隔一秒報(bào)時(shí)一秒,到達(dá)00分00秒時(shí),整點(diǎn)報(bào)時(shí)。整點(diǎn)報(bào)時(shí)聲的頻率應(yīng)與其它的報(bào)時(shí)聲頻有明顯區(qū)別。

#設(shè)計(jì)提示(僅供參考):(1)對(duì)頻率輸入的考慮

數(shù)字鐘內(nèi)所需的時(shí)鐘頻率有:基準(zhǔn)時(shí)鐘應(yīng)為周期一秒的標(biāo)準(zhǔn)信號(hào)。報(bào)時(shí)頻率可選用1KHz和2KHz左右(兩種頻率相差八度音,即頻率相差一倍)。另外,為防止按鍵反跳、抖動(dòng),微動(dòng)開(kāi)關(guān)輸入應(yīng)采用寄存器輸入形式,其時(shí)鐘應(yīng)為幾十赫茲。

(2)計(jì)時(shí)部分計(jì)數(shù)器設(shè)計(jì)的考慮 分、秒計(jì)數(shù)器均為模60計(jì)數(shù)器。

小時(shí)計(jì)數(shù)為模24計(jì)數(shù)器,同理可建一個(gè)24進(jìn)制計(jì)數(shù)器的模塊。(3)校時(shí)設(shè)計(jì)的考慮

數(shù)字鐘校準(zhǔn)有3個(gè)控制鍵:時(shí)校準(zhǔn)、分校準(zhǔn)和秒校準(zhǔn)。

微動(dòng)開(kāi)關(guān)不工作,計(jì)數(shù)器正常工作。按下微動(dòng)開(kāi)關(guān)后,計(jì)數(shù)器以8Hz頻率連續(xù)計(jì)數(shù)(若只按一下,則計(jì)數(shù)器增加一位),可調(diào)用元件庫(kù)中的邏輯門(mén)建一個(gè)控制按鍵的模塊,即建立開(kāi)關(guān)去抖動(dòng)電路(見(jiàn)書(shū)70頁(yè))。

(4)報(bào)時(shí)設(shè)計(jì)的考慮

可以將高頻時(shí)鐘分頻得到約2KHz和1KHz的音頻,作為數(shù)字鐘的報(bào)時(shí)頻率。當(dāng)電子鐘顯示XX:59:50時(shí),數(shù)字鐘開(kāi)始報(bào)時(shí)“DO“,持續(xù)一秒,而且每隔一秒報(bào)一下,直至顯示XX:00:00時(shí)報(bào)“DI”,持續(xù)一秒后停止。最后輸出至喇叭。應(yīng)調(diào)用元件庫(kù)中的邏輯門(mén)建一個(gè)控制報(bào)時(shí)的模塊。

(5)建一個(gè)七段譯碼的模塊

因在系統(tǒng)可編程器件實(shí)驗(yàn)箱上的數(shù)碼管沒(méi)有經(jīng)過(guò)譯碼,故要用AHDL語(yǔ)言寫(xiě)一個(gè)七段譯碼的模塊,且應(yīng)考慮數(shù)碼管為共陽(yáng)極。數(shù)碼管上的點(diǎn)(D2、D4、D6)應(yīng)置Vcc。

四、課程設(shè)計(jì)所需要儀器

1、計(jì)算機(jī)一臺(tái)

2、quartusⅡ軟件

3、FPGA開(kāi)發(fā)板

五、設(shè)計(jì)步驟

1、模塊介紹

(1)分頻模塊:產(chǎn)生1Hz、1KHz、2KHz頻率(2)計(jì)數(shù)器模塊:生成60進(jìn)制、24進(jìn)制計(jì)數(shù)器(3)控制模塊:按鍵控制、按鍵消抖

(4)顯示模塊:7段數(shù)碼管顯示器,分別顯示小時(shí)、分鐘、秒(5)報(bào)時(shí)模塊:進(jìn)行整點(diǎn)報(bào)時(shí)

2、各個(gè)模塊的設(shè)計(jì)與仿真

2.1分頻模塊

CLK晶振頻率50MHZ,分成2KHZ,1KHZ,1HZ的信號(hào)。基準(zhǔn)1HZ信號(hào)作為時(shí)鐘計(jì)時(shí)的秒計(jì)數(shù)時(shí)鐘信號(hào);分頻的1KHZ,2KHZ信號(hào)用于報(bào)時(shí)電路的不同聲訊。

程序代碼:

library ieee;use ieee.std_logic_1164.all;entity fre is port(clk ,sel: in std_logic;clk1hz,clk1khz,clk2khz:out std_logic);end fre;architecture beh of fre is signal data1khz,data2khz,data1hz : std_logic := '0';begin clk1hz <= data1hz;clk1khz <= data1khz;clk2khz <= data2khz;clk1khz_pro : process(clk)--產(chǎn)生1khz信號(hào) variable cnt : integer range 0 to 24999;begin if clk'event and clk='1' then if cnt = 24999 then cnt := 0;data1khz <= not data1khz;else cnt := cnt + 1;end if;end if;end process clk1khz_pro;clk2khz_pro : process(clk)--variable cnt : integer range 0 to 12499;begin if clk'event and clk='1' then if cnt = 12499 then cnt := 0;data2khz <= not data2khz;else cnt := cnt + 1;end if;end if;end process clk2khz_pro;clk1hz_pro : process(data1khz)--variable cnt : integer range 0 to 499;begin if data1khz'event and data1khz='1' then if sel='0' then cnt:=0;else if cnt = 499 then cnt := 0;data1hz <= not data1hz;else cnt := cnt + 1;end if;end if;end if;end process clk1hz_pro;end beh;

輸入模塊電路圖:

產(chǎn)生2khz信號(hào) 產(chǎn)生1hz 信號(hào) 5 freclkclk1hzclk2khzinst selclk1khz2.2計(jì)數(shù)器模塊

由秒計(jì)數(shù)器,分計(jì)數(shù)器,時(shí)計(jì)數(shù)器組成了最基本的數(shù)字鐘計(jì)時(shí)電路,兩個(gè)六十進(jìn)制計(jì)數(shù)器與二十四進(jìn)制計(jì)數(shù)器組合構(gòu)成。

程序代碼:

library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use IEEE.STD_LOGIC_ARITH.ALL;

entity shuzizhong is port(clk_change : in std_logic;s_en,m_en,h_en:in std_logic;sel:in std_logic;secout,minout,hourout :out std_logic;sl,sh,ml,mh,hl,hh:out std_logic_vector(3 downto 0);a:out std_logic_vector(15downto 0));end shuzizhong;architecture behav of shuzizhong is

signal low_rega,high_rega,low_regb,high_regb,low_regc,high_regc :std_logic_vector(3 downto 0):=“0000”;signal sout,mout,hout :std_logic :='0';begin--秒的60進(jìn)制進(jìn)制 counter_sec_l : process(clk_change,s_en)begin

sl<=low_rega;sh<=high_rega;ml<=low_regb;mh<=high_regb;hl<=low_regc;hh<=high_regc;6 if clk_change'event and clk_change='1' then if s_en='1' then if low_rega=“1001” then low_rega <= “0000”;else low_rega <= low_rega+'1';end if;end if;end if;end process counter_sec_l;counter_sec_h : process(clk_change,s_en,low_rega)begin if clk_change'event and clk_change='1' then if s_en='1' then if low_rega=“1001” then if high_rega =“0101”then high_rega <= “0000”;else high_rega <= high_rega+'1';end if;end if;end if;end if;end process counter_sec_h;sout <= '1' when low_rega=“1001” and high_rega=“0101” else '0';

----分鐘的60進(jìn)制設(shè)置 counter_min_l : process(clk_change,m_en)begin if clk_change'event and clk_change='1' then if m_en='1' then if sout='1'or sel='0' then if low_regb=“1001” then low_regb <= “0000”;else low_regb <= low_regb+'1';end if;end if;end if;end if;end process counter_min_l;counter_min_h : process(clk_change,m_en,low_regb)begin if clk_change'event and clk_change='1' then 7 if sout='1'or sel='0' then if m_en='1' then if low_regb=“1001” then

if high_regb =“0101”then

high_regb <= “0000”;else high_regb <= high_regb+'1';end if;end if;end if;end if;end if;end process counter_min_h;mout <= '1' when low_regb=“1001” and high_regb=“0101”and sout='1' else '0';--小時(shí)的24進(jìn)制設(shè)置 counter_hour_l : process(clk_change,h_en)begin if clk_change'event and clk_change='1' then if h_en='1' then if mout='1'or sel='0' then if low_regc=“1001”or hout='1' then low_regc <= “0000”;else low_regc <= low_regc+'1';end if;end if;end if;end if;end process counter_hour_l;counter_hour_h : process(clk_change,h_en,hout)begin if clk_change'event and clk_change='1' then if mout='1'or sel='0' then if h_en='1' then if hout='1' then high_regc<=“0000”;else if low_regc=“1001” then high_regc <= high_regc+'1';end if;end if;end if;8 end if;end if;end process counter_hour_h;hout <= '1' when low_regc=“0011” and high_regc=“0010” else '0';secout<=sout;minout<=mout;hourout<=hout;a<=high_regb&low_regb&high_rega&low_rega;end behav;

輸入模塊電路圖:

shuzizhongclk_changes_enm_enh_enselsecoutminouthouroutsl[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]hh[3..0]a[15..0]inst

2.3控制模塊

分五個(gè)狀態(tài)0狀態(tài)正常計(jì)時(shí),按下按鍵進(jìn)入下一狀態(tài)開(kāi)始調(diào)時(shí)模式1,按下按鍵進(jìn)入調(diào)秒模式2,按下按鍵進(jìn)入調(diào)分模式3,按下按鍵進(jìn)入調(diào)小時(shí)模式4.按下按鍵恢復(fù)正常計(jì)時(shí)模式。

程序代碼:

library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity key_press is port(set ,mode: in std_logic;clk1khz,clk1hz: in std_logic;secout,minout: in std_logic;clk_change,clk2hz_en:out std_logic;sel,s_ce,m_ce,h_ce:out std_logic;s_en,m_en,h_en:out std_logic);end key_press;architecture beh of key_press is 9 signal key1,key2:std_logic;signal sce_reg, mce_reg ,hce_reg:std_logic;signal ssl,ssen,mmen,hhen:std_logic;signal con : integer range 0 to 4 :=0;--按鍵按下(延時(shí))begin

key_press2 : process(set,clk1khz)variable cnt :integer range 0 to 999;begin if set='0' then if clk1khz'event and clk1khz='1'then if cnt=50 and set='0' then cnt :=cnt+1;key2 <= '1';else cnt:=cnt+1;key2 <= '0';end if;end if;else cnt:=0;key2<='0';end if;end process key_press2;key_press1 : process(mode,clk1khz)variable cnt :integer range 0 to 999;begin if mode='0' then if clk1khz'event and clk1khz='1'then if cnt=50 and mode='0' then cnt :=cnt+1;key1 <= '1';else cnt:=cnt+1;key1 <= '0';end if;end if;else cnt:=0;key1<='0';end if;end process key_press1;count : process(key1,key2)begin if key1'event and key1='1' then if con=4 then con<=0;else con<=con+1;end if;end if;10 end process count;con_pro : process(con)begin case con is when 0 => ssl<='1';sce_reg <= '0';ssen <='1';mce_reg <= '0';mmen <='1';hce_reg <= '0';hhen <='1';clk2hz_en <='0';when 1 => ssl<='0';sce_reg <= '0';ssen <='1';mce_reg <= '0';mmen <='1';hce_reg <= '0';hhen <='1';clk2hz_en <='1';when 2 => ssl<='0';sce_reg <= '1';ssen <='1';mce_reg <= '0';mmen <='0';hce_reg <= '0';hhen <='0';clk2hz_en <='1';when 3 => ssl<='0';sce_reg <= '0';ssen <='0';mce_reg <= '1';mmen <='1';hce_reg <= '0';hhen <='0';clk2hz_en <='1';when 4 => ssl<='0';sce_reg <= '0';ssen <='0';mce_reg <= '0';mmen <='0';hce_reg <= '1';hhen <='1';clk2hz_en <='1';when others => ssl<='0';sce_reg <= '0';ssen <='1';mce_reg <= '0';mmen <='1';hce_reg <= '0';hhen <='1';clk2hz_en <='0';end case;end process con_pro;sel_pro : process(ssl)begin case ssl is when '0'=> s_ce<=sce_reg;m_ce<=mce_reg;h_ce<=hce_reg;clk_change<=key2;when '1'=> s_ce<=ssen;11 m_ce<=mmen;h_ce<=hhen;clk_change<=clk1hz;when others=> s_ce<=ssen;m_ce<=secout;h_ce<=minout;clk_change<=clk1hz;end case;end process sel_pro;sel<=ssl;s_en<=ssen;m_en<=mmen;h_en<=hhen;end beh;

輸入模塊電路圖: key_presssetclk_changemodeclk2hz_enclk1khzselclk1hzs_cesecoutm_ceminouth_ces_enm_enh_eninst

2.4數(shù)碼管分配

程序代碼:

library ieee;use ieee.std_logic_1164.all;entity display is port(datain : in std_logic_vector(3 downto 0);dataout : out std_logic_vector(7 downto 0));end display;architecture duan of display is begin process(datain)begin case datain is 12 when “0000” => dataout <=“11000000”;--dp,g,f,e,d,c,b,a when “0001” => dataout <=“11111001”;when “0010” => dataout <=“10100100”;when “0011” => dataout <=“10110000”;when “0100” => dataout <=“10011001”;when “0101” => dataout <=“10010010”;when “0110” => dataout <=“10000010”;when “0111” => dataout <=“11111000”;when “1000” => dataout <=“10000000”;when “1001” => dataout <=“10010000”;when “1010” => dataout <=“10111111”;when “1011” => dataout <=“10000011”;when “1100” => dataout <=“10100111”;when “1101” => dataout <=“10100001”;when “1110” => dataout <=“10000110”;when “1111” => dataout <=“10001110”;when others => null;end case;end process;end;

輸入模塊電路圖:

displaydatain[3..0]dataout[7..0]inst

2.5顯示模塊

使用七段數(shù)碼管顯示小時(shí)、分鐘與秒

程序代碼:

library ieee;use ieee.std_logic_1164.all;entity scan is port(clk1khz : in std_logic;sl,sh,ml,mh,hl,hh : in std_logic_vector(3 downto 0);clk2hz_en : in std_logic;s_ce,m_ce,h_ce : in std_logic;en_out : out std_logic_vector(7 downto 0);13 dataout : out std_logic_vector(3 downto 0));end scan;architecture beh of scan is signal cnt : integer range 0 to 7;signal en : std_logic_vector(7 downto 0);signal clk2hz : std_logic;signal h_ce_reg,m_ce_reg,s_ce_reg : std_logic;begin h_ce_reg <= not h_ce;m_ce_reg <= not m_ce;s_ce_reg <= not s_ce;cnt_pro : process(clk1khz)begin if clk1khz'event and clk1khz='1' then if cnt = 7 then cnt <= 0;else cnt <= cnt + 1;end if;end if;end process cnt_pro;clk2hz_pro :process(clk1khz)variable c : integer range 0 to 499 := 0;begin if clk1khz'event and clk1khz='1' then if clk2hz_en ='1' then if c =499 then c := 0;clk2hz <= not clk2hz;else c := c + 1;end if;else clk2hz <= '0';end if;end if;end process clk2hz_pro;scan_pro : process(cnt,sl,sh,ml,mh,hl,hh)begin case cnt is when 0 => dataout <= sl;en <= “11111110”;when 1 => dataout <= sh;en <= “11111101”;when 2 => dataout <= ml;en <= “11110111”;when 3 => dataout <= mh;en <= “11101111”;when 4 => dataout <= hl;en <= “10111111”;14 when 5 => dataout <= hh;en <= “01111111”;when 6 => dataout <= “1010”;en <= “11111011”;when 7 => dataout <= “1010”;en <= “11011111”;when others => null;end case;end process scan_pro;

en_out <= en or((clk2hz & clk2hz)or(h_ce_reg & h_ce_reg))& clk2hz &((clk2hz & clk2hz)or(m_ce_reg & m_ce_reg))& clk2hz &((clk2hz & clk2hz)or(s_ce_reg & s_ce_reg));end beh;

輸入模塊電路圖:

scanclk1khzen_out[7..0]sl[3..0]dataout[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]hh[3..0]clk2hz_ens_cem_ceh_ceinst

2.6報(bào)時(shí)模塊

利用蜂鳴器進(jìn)行整點(diǎn)報(bào)時(shí)

程序代碼:

library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use IEEE.STD_LOGIC_ARITH.ALL;--整點(diǎn)報(bào)時(shí) entity baoshi is port(clk1khz,clk2khz : in std_logic;a:in std_logic_vector(15 downto 0);sel:in std_logic;bell:out std_logic);end baoshi;architecture zhong of baoshi is signal c1,ring:std_logic;begin ring_bell :process(clk1khz,clk2khz)15 begin case a is when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk2khz;when “***0” => c1<=clk2khz;when others => c1<='0';end case;end process ring_bell;

bs: process(c1)begin if sel='1' then if c1='1' then ring<='0';else ring<='1';end if;end if;end process bs;bell<=ring;

end zhong;

輸入模塊電路圖:

baoshiclk1khzbellclk2khza[15..0]selinst

整體模塊電路圖

displayshuzizhongs_enm_enh_enselclk_changes_enm_enh_enselsecoutminouthouroutsl[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]hh[3..0]setmodefreclkINPUTVCCINPUTVCCdata[3..0]datain[3..0]secoutminoutinst1scanclk1khzclk1khzsl[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]a[15..0]dataout[7..0]OUTPUTdataout[7..0]en_out[7..0]dataout[3..0]OUTPUTen_out[7..0]data[3..0]key_presssetclk1khzmodeclk1khzclk1hzsecoutminoutclk_changeclk2hz_ensels_cem_ceh_ces_enm_enh_eninst6s_enm_enh_enselinst7a[15..0]INPUTVCChh[3..0]clk2hz_ens_cem_ceh_ceinst4baoshiclk1khzclk2khza[15..0]selclk1khzbellclk2khza[15..0]sel++selclkclk1hzselclk1khzclk2khzinst2clk1khzclk2khzsecoutminoutOUTPUTbellinst

六、調(diào)試中遇到的問(wèn)題及解決的方法:

1、編程時(shí),經(jīng)常導(dǎo)致語(yǔ)法錯(cuò)誤,如:“;”沒(méi)有寫(xiě)上,變量類(lèi)型沒(méi)有預(yù)先標(biāo)明,前后變量名字由于缺少一個(gè)或多一個(gè)字母而導(dǎo)致出錯(cuò)。解決辦法:對(duì)照錯(cuò)誤,認(rèn)真檢查程序,看哪個(gè)地方的標(biāo)點(diǎn),變量沒(méi)有寫(xiě)上或標(biāo)明。

2、進(jìn)行編譯或波形仿真時(shí),經(jīng)常得到的不是預(yù)想中的結(jié)果。

解決辦法:將需要編譯或進(jìn)行仿真的實(shí)體文件置頂,經(jīng)檢錯(cuò)無(wú)誤后,進(jìn)行波形仿真,在仿真之前需要合理設(shè)置仿真結(jié)束時(shí)間和信號(hào)周期。

3、在控制時(shí)間的顯示的時(shí)候,由于變量太多多發(fā)現(xiàn)不能完全的控制住變量,導(dǎo)致顯示的時(shí)候出現(xiàn)了亂碼,數(shù)碼管顯示不正常 解決辦法:減少變量,仔細(xì)推敲,合理命名。

七、心得體會(huì)

一個(gè)多星期的課程設(shè)計(jì)讓我受益匪淺,也讓我真正明白理論與實(shí)踐相結(jié)合的重要性。通過(guò)具體實(shí)踐才能讓自己清楚哪些知識(shí)已經(jīng)掌握,哪些知識(shí)仍需鞏固加強(qiáng)。與此同時(shí),我也對(duì)EDA以及VHDL語(yǔ)言有了進(jìn)一步了解,對(duì)于其結(jié)構(gòu)、語(yǔ)法、功能等認(rèn)識(shí)不少。當(dāng)然,我目前所做的還僅僅只是一些基本操作,要想真正將其融會(huì)貫通還需要今后更多的學(xué)習(xí)與實(shí)踐。雖然只是一個(gè)小設(shè)計(jì),我卻也從中學(xué)到了不少設(shè)計(jì)流程和一些相關(guān)問(wèn)題。設(shè)計(jì)是一個(gè)十分嚴(yán)謹(jǐn)?shù)倪^(guò)程,容不得隨意和馬虎。要想快速而高效地完成一項(xiàng)設(shè)計(jì),必須先有一個(gè)清晰明了的設(shè)計(jì)思路,設(shè)想好一個(gè)整體框架,然后在此基礎(chǔ)上,逐漸將各個(gè)部分功能進(jìn)行完善。在設(shè)計(jì)的過(guò)程中,也曾遇到不少困難,但正所謂堅(jiān)持就是勝利,要想取得成功,必須要有努力付出,這樣所取得的結(jié)果才更有意義。

第四篇:用狀態(tài)機(jī)實(shí)現(xiàn)的EDA多功能數(shù)字鐘課程設(shè)計(jì)VHDL代碼

設(shè)計(jì)并實(shí)現(xiàn)具有一定功能的數(shù)字鐘

1、該數(shù)字鐘可以實(shí)現(xiàn)3個(gè)功能:計(jì)時(shí)功能、整點(diǎn)報(bào)時(shí)功能和重置時(shí)間功能,因此有3個(gè)功能:計(jì)時(shí)、重置時(shí)間、復(fù)位。

2、對(duì)所有設(shè)計(jì)的小系統(tǒng)能夠正確分析;

3、基于VHDL語(yǔ)言描述系統(tǒng)的功能;

4、在quartus 2環(huán)境中編譯通過(guò);

5、仿真通過(guò)并得到正確的波形;

6、給出相應(yīng)的設(shè)計(jì)報(bào)告。

其中計(jì)時(shí)模塊有4部分構(gòu)成:秒計(jì)時(shí)器(second)、分計(jì)時(shí)器(minute)、時(shí)計(jì)時(shí)器(hour)、日計(jì)時(shí)器(date)、月計(jì)時(shí)器(mouth)、年計(jì)時(shí)器(year)

1)秒計(jì)時(shí)器(second)是由一個(gè)60進(jìn)制的計(jì)數(shù)器構(gòu)成的,具有清0、置數(shù)和計(jì)數(shù)功能。其中reset為清0信號(hào),當(dāng)reset為0時(shí),秒計(jì)時(shí)器清0;set 為置數(shù)信號(hào),當(dāng)set為0時(shí),秒計(jì)時(shí)器置數(shù),置s1的值。clk為驅(qū)動(dòng)秒計(jì)時(shí)器的時(shí)鐘,sec為秒計(jì)時(shí)器的輸出,ensec為秒計(jì)時(shí)器的進(jìn)位信號(hào),作為下一級(jí)的時(shí)鐘輸入信號(hào)。

2)分計(jì)時(shí)器(minute)是由一個(gè)60進(jìn)制的計(jì)數(shù)器構(gòu)成的,具有清0、置數(shù)和計(jì)數(shù)功能。其中reset為清0信號(hào),當(dāng)reset為0時(shí),分計(jì)時(shí)器清0;set 為置數(shù)信號(hào),當(dāng)set為0時(shí),分計(jì)時(shí)器置數(shù),置m1的值。clkm為驅(qū)動(dòng)分計(jì)時(shí)器工作的時(shí)鐘,與ensec相連接;min為分計(jì)時(shí)器的輸出;enmin為分計(jì)時(shí)器的進(jìn)位信號(hào),作為下一級(jí)的時(shí)鐘輸入信號(hào)。

3)時(shí)計(jì)時(shí)器(hour)是由一個(gè)24進(jìn)制的計(jì)數(shù)器構(gòu)成的,具有清0、置數(shù)和計(jì)數(shù)功能。其中reset為清0信號(hào),當(dāng)reset為0時(shí),時(shí)計(jì)時(shí)器清0;set 為置數(shù)信號(hào),當(dāng)set為0時(shí),時(shí)計(jì)時(shí)器置數(shù),置h1的值。clkh為驅(qū)動(dòng)時(shí)計(jì)時(shí)器工作的時(shí)鐘,與enmin相連接;hour為時(shí)計(jì)時(shí)器的輸出;enhour為時(shí)計(jì)時(shí)器的進(jìn)位信號(hào),作為下一級(jí)的時(shí)鐘輸入信號(hào)。

4)日計(jì)時(shí)器(date1)是由一個(gè)60進(jìn)制的計(jì)數(shù)器構(gòu)成的,具有清0、置數(shù)和計(jì)數(shù)功能。其中reset為清0信號(hào),當(dāng)reset為0時(shí),星期計(jì)時(shí)器清0;set 為置數(shù)信號(hào),當(dāng)set為0時(shí),星期計(jì)時(shí)器置數(shù),置d1的值。clkd為驅(qū)動(dòng)星期計(jì)時(shí)器工作的時(shí)鐘,與enhour相連接;date為日計(jì)時(shí)器的輸出,endate為分計(jì)時(shí)器的進(jìn)位信號(hào),作為下一級(jí)的時(shí)鐘輸入信號(hào),由于月份的天數(shù)存在天數(shù)不同,閏年2月的天數(shù)為28天等情況,還設(shè)計(jì)了一個(gè)潤(rùn)年判別器,準(zhǔn)確顯示時(shí)間。

5)月計(jì)時(shí)器(mouth)是由一個(gè)60進(jìn)制的計(jì)數(shù)器構(gòu)成的,具有清0、置數(shù)和計(jì)數(shù)功能。其中reset為清0信號(hào),當(dāng)reset為0時(shí),星期計(jì)時(shí)器清0;set 為置數(shù)信號(hào),當(dāng)set為0時(shí),星期計(jì)時(shí)器置數(shù),置mou1的值,clkmou為驅(qū)動(dòng)星期計(jì)時(shí)器工作的時(shí)鐘,與enday相連接;mou為日計(jì)時(shí)器的輸出,enmou為分計(jì)時(shí)器的進(jìn)位信號(hào),作為下一級(jí)的時(shí)鐘輸入信號(hào)。6)計(jì)時(shí)器(year)是由一個(gè)60進(jìn)制的計(jì)數(shù)器構(gòu)成的,具有清0、置數(shù)和計(jì)數(shù)功能。其中reset為清0信號(hào),當(dāng)reset為0時(shí),星期計(jì)時(shí)器清0;set 為置數(shù)信號(hào),當(dāng)set為0時(shí),星期計(jì)時(shí)器置數(shù),置y1的值,clky為驅(qū)動(dòng)星期計(jì)時(shí)器工作的時(shí)鐘,與enmou相連接;year為日計(jì)時(shí)器的輸出。VHDL程序

1、屏幕切換模塊

運(yùn)用狀態(tài)機(jī)進(jìn)行屏幕切換,分別顯示年月日,以及時(shí)分秒 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity mux3 is

Port(clk,Reset,sel : in std_logic;

int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,int12:IN STD_LOGIC_VECTOR(3 DOWNTO 0);--rst must

a1,a2,a3,a4,a5,a6: out std_logic_vector(3 downto 0));end mux3;

architecture Behavioral of mux3 is

TYPE states IS(st0, st1, st2, st3, st4, st5, st6, st7);

SIGNAL STX: states;

begin

COM1 : PROCESS(STX,int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,int12)

BEGIN--決定轉(zhuǎn)換狀態(tài)的進(jìn)程

CASE STX IS

WHEN st0 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;

WHEN st1 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;

WHEN st2 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;

WHEN st3 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;

WHEN st4 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;

WHEN st5 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;

WHEN st6 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;

WHEN st7 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;

WHEN OTHERS => NULL;

END CASE;

END PROCESS COM1;REG: PROCESS(clk,Reset,sel)

--主控時(shí)序進(jìn)程

BEGIN

IF Reset = '1' THEN

STX<= st0;

--異步復(fù)位

ELSIF clk='1' AND clk'EVENT THEN

if sel='1' then

CASE STX IS

WHEN st0=>STX<=st1;

WHEN st1=>STX<=st2;

WHEN st2=>STX<=st3;

WHEN st3=>STX<=st4;

WHEN st4=>STX<=st5;

WHEN st5=>STX<=st6;

WHEN st6=>STX<=st7;

WHEN st7=>STX<=st0;

END CASE;

END IF;

END if;END PROCESS;

2、顯示切換程序 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity mux1 is

Port(clk,ina,inb,sel,Reset : in std_logic;

result : out std_logic);end mux1;

architecture Behavioral of mux1 is

TYPE state IS(st0,st1,st2,st3,st4,st5,st6,st7);

SIGNAL STX:state;begin REG1: PROCESS(ina,inb,STX)

BEGIN

CASE STX IS

WHEN st0=>result<=ina;

WHEN st1=>result<=ina;

WHEN st2=>result<=inb;

WHEN st3=>result<=inb;

WHEN st4=>result<=inb;

WHEN st5=>result<=inb;

WHEN st6=>result<=inb;

WHEN st7=>result<=inb;

END CASE;

END PROCESS;REG2:PROCESS(clk,sel,Reset)BEGIN IF(Reset='1')THEN

STX<=st0;ELSIF(clk'EVENT AND clk='1')THEN

if sel='1' then CASE STX IS WHEN st0=>STX<=st1;WHEN st1=>STX<=st2;WHEN st2=>STX<=st3;WHEN st3=>STX<=st4;WHEN st4=>STX<=st5;WHEN st5=>STX<=st6;WHEN st6=>STX<=st7;WHEN st7=>STX<=st0;

END CASE;END IF;end if;END PROCESS REG2;

end Behavioral;

3、置數(shù)操作模塊

運(yùn)用狀態(tài)機(jī),進(jìn)行置數(shù)操作 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity mux is

Port(clk,ina,inb,sel,Reset : in std_logic;

r1,r2,r3,r4,r5,r6 : out std_logic);end mux;

architecture Behavioral of mux is TYPE state IS(st0,st1,st2,st3,st4,st5,st6,st7);

SIGNAL STX:state;begin PROCESS(ina,inb,STX)BEGIN CASE STX IS WHEN st0=>r1<=ina;r2<='0';r3<='0';r4<='0';r5<='0';r6<='0';WHEN st1=>r1<=ina;r2<='0';r3<='0';r4<='0';r5<='0';r6<='0';WHEN st2=>r1<='0';r2<='0';r3<='0';r4<='0';r5<='0';r6<=inb;WHEN st3=>r1<='0';r2<='0';r3<='0';r4<='0';r5<=inb;r6<='0';WHEN st4=>r1<='0';r2<='0';r3<='0';r4<=inb;r5<='0';r6<='0';WHEN st5=>r1<='0';r2<='0';r3<=inb;r4<='0';r5<='0';r6<='0';WHEN st6=>r1<='0';r2<=inb;r3<='0';r4<='0';r5<='0';r6<='0';WHEN st7=>r1<=inb;r2<='0';r3<='0';r4<='0';r5<='0';r6<='0';END CASE;END PROCESS;PROCESS(clk,sel,Reset)BEGIN IF(Reset='1')THEN STX<=st0;ELSIF(clk'EVENT AND clk='1')THEN if sel='1' then CASE STX IS WHEN st0=>STX<=st1;WHEN st1=>STX<=st2;WHEN st2=>STX<=st3;WHEN st3=>STX<=st4;WHEN st4=>STX<=st5;WHEN st5=>STX<=st6;WHEN st6=>STX<=st7;WHEN st7=>STX<=st0;

END CASE;END IF;end if;END PROCESS;end Behavioral;end Behavioral;

4、秒顯示模塊 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity secute1 is

Port(clkm,set,reset : in std_logic;

sec2,sec1 : inout std_logic_vector(3 downto 0);

ensec : out std_logic);end secute1;

architecture Behavioral of secute1 is

begin

Process(clkm,reset,set)

Begin

If reset='1' then sec2<=“0000”;sec1<=“0000”;

Elsif set='1' then sec2<=“0101”;sec1<=“1000”;

Elsif(clkm'event and clkm='1')then

if sec2=“0101” AND sec1=“1001” then sec2<=“0000”;sec1<=“0000”;ensec<='1';

elsif sec1=“1001” then sec2<=sec2+'1';sec1<=“0000”;ensec<='0';

else sec1<=sec1+'1';ensec<='0';

end if;end if;End process;end Behavioral;

5、分顯示模塊 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity minute1 is

Port(clkm,set,reset : in std_logic;

min2,min1 : inout std_logic_vector(3 downto 0);

enmin : out std_logic);end minute1;

architecture Behavioral of minute1 is

begin

Process(clkm,reset,set)

Begin

If reset='1' then min2<=“0000”;min1<=“0000”;

Elsif set='1' then min2<=“0101”;min1<=“1000”;

Elsif(clkm'event and clkm='1')then

if min2=“0101” AND min1=“1001” then min2<=“0000”;min1<=“0000”;enmin<='1';

elsif min1=“1001” then min2<=min2+'1';min1<=“0000”;enmin<='0';

else min1<=min1+'1';enmin<='0';

end if;end if;End process;end Behavioral;

6、小時(shí)顯示模塊 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity hour1 is

Port(clkh,set,reset: in std_logic;

hor2,hor1 : inout std_logic_vector(3 downto 0);

enhour : out std_logic);end hour1;

architecture Behavioral of hour1 is

begin Process(clkh,reset,set)

Begin

If reset='1' then hor2<=“0000”;hor1<=“0000”;

Elsif set='1' then hor2<=“0010”;hor1<=“0011”;

Elsif(clkh'event and clkh='1')then

if hor2=“0010” AND hor1=“0011” then hor2<=“0000”;hor1<=“0000”;enhour<='1';

elsif hor1=“1001” then hor2<=hor2+'1';hor1<=“0000”;enhour<='0';

else hor1<=hor1+'1';enhour<='0';

end if;

end if;End process;end Behavioral;

7、日顯示模塊(已加入閏年判斷功能)library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity date1 is

Port(clkd,set : in std_logic;

dat2,dat1 : inout std_logic_vector(3 downto 0);

endate : out std_logic);end date1;

architecture Behavioral of date1 is

begin

Process(clkd,set)

Begin

if set='1' then dat2<=“0010”;dat1<=“1000”;

Elsif(clkd'event and clkd='1')then

if dat2=“0011” AND dat1=“0000” then dat2<=“0000”;dat1<=“0001”;endate<='1';elsif dat1=“1001” then dat2<=dat2+'1';dat1<=“0000”;endate<='0';

else dat1<=dat1+'1';endate<='0';

end if;end if;End process;end Behavioral;

8、月顯示模塊 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity month1 is

Port(clkn,set: in std_logic;

mon2,mon1 : inout std_logic_vector(3 downto 0);

enmon : out std_logic);end month1;

architecture Behavioral of month1 is

begin

Process(clkn,set)

Begin

if set='1' then mon2<=“0000”;mon1<=“0110”;

Elsif(clkn'event and clkn='1')then

if mon2=“0001” AND mon1=“0010” then mon2<=“0000”;mon1<=“0001”;enmon<='1';

elsif mon1=“1001” then mon2<=mon2+'1';mon1<=“0000”;enmon<='0';

else mon1<=mon1+'1';enmon<='0';

end if;end if;End process;

9、年顯示模塊 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;

--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;

entity yearth1 is

Port(clkn,set: in std_logic;

year2,year1 : inout std_logic_vector(3 downto 0);

enyear : out std_logic);end yearth1;

architecture Behavioral of yearth1 is

begin

Process(clkn,set)

Begin

if set='1' then year2<=“0001”;year1<=“0001”;

Elsif(clkn'event and clkn='1')then

if year2=“1001” AND year1=“1001” then year2<=“0000”;year1<=“0001”;

elsif year1=“1001” then year2<=year2+'1';year1<=“0000”;enyear<='0';

else year1<=year1+'1';enyear<='0';

end if;end if;

end Behavioral;

第五篇:EDA數(shù)字鐘設(shè)計(jì)

數(shù)字鐘

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

1、掌握多位計(jì)數(shù)器相連的設(shè)計(jì)方法。

2、掌握十進(jìn)制,六進(jìn)制,二十四進(jìn)制計(jì)數(shù)器的設(shè)計(jì)方法。

3、掌握揚(yáng)聲器的驅(qū)動(dòng)及報(bào)時(shí)的設(shè)計(jì)。

4、LED燈的花樣顯示。

5、掌握CPLD技術(shù)的層次化設(shè)計(jì)方法。

二、實(shí)驗(yàn)器材

1、主芯片Altera EPF10K10LC84-4。2、8個(gè)LED燈。

3、揚(yáng)聲器。4、4位數(shù)碼顯示管。5、8個(gè)按鍵開(kāi)關(guān)(清零,調(diào)小時(shí),調(diào)分鐘)。

三、實(shí)驗(yàn)內(nèi)容

根據(jù)電路特點(diǎn),運(yùn)用層次設(shè)計(jì)概念設(shè)計(jì)。將此設(shè)計(jì)任務(wù)分成若干模塊,規(guī)定每一模塊的功能和各模塊之間的接口。

1、時(shí)計(jì)時(shí)程序: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

entity hour is

port(reset,clk : in std_logic;

daout : out std_logic_vector(7 downto 0));end hour;

architecture behav of hour is

signal count : std_logic_vector(3 downto 0);signal counter : std_logic_vector(3 downto 0);begin

p1: process(reset,clk)

begin

if reset='0' then

count<=“0000”;

counter<=“0000”;

elsif(clk'event and clk='1')then

if(counter<2)then

if(count=9)then

count<=“0000”;

counter<=counter + 1;

else

count<=count+1;

end if;

else

if(count=3)

then

counter<=“0000”;

else

count<=count+1;

count<=“0000”;

end if;

end if;

end if;

end process;

daout(7 downto 4)<=counter;daout(3 downto 0)<=count;

end behav;

2、分計(jì)時(shí)程序: library ieee;

use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

entity minute is

port(reset,clk,sethour: in std_logic;

daout : out std_logic_vector(7 downto 0);

enhour : out std_logic);end minute;

architecture behav of minute is

signal count : std_logic_vector(3 downto 0);signal counter : std_logic_vector(3 downto 0);signal carry_out1 : std_logic;signal carry_out2 : std_logic;begin

p1: process(reset,clk)begin

if reset='0' then

count<=“0000”;

counter<=“0000”;

elsif(clk'event and clk='1')then

if(counter<5)then

if(count=9)then

count<=“0000”;

counter<=counter + 1;

else

count<=count+1;

end if;

carry_out1<='0';

else

if(count=9)then

count<=“0000”;

counter<=“0000”;

carry_out1<='1';

else

count<=count+1;

carry_out1<='0';

end if;

end if;end if;end process;

p2: process(clk)begin

if(clk'event and clk='0')then

if(counter=0)then

if(count=0)then

carry_out2<='0';

end if;

else

carry_out2<='1';

end if;end if;end process;

daout(7 downto 4)<=counter;daout(3 downto 0)<=count;enhour<=(carry_out1 and carry_out2)or sethour;end behav;

3、秒計(jì)時(shí)程序: library ieee;

use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

entity second is

port(reset,clk,setmin : in std_logic;

daout : out std_logic_vector(7 downto 0);

enmin : out std_logic);end second;

architecture behav of second is

signal count : std_logic_vector(3 downto 0);signal counter : std_logic_vector(3 downto 0);signal carry_out1 : std_logic;signal carry_out2 : std_logic;begin

p1: process(reset,clk)begin

if reset='0' then

count<=“0000”;

counter<=“0000”;

elsif(clk'event and clk='1')then

if(counter<5)

then

if

(count=9)

then

count<=“0000”;

counter<=counter + 1;

else

count<=count+1;

end if;

carry_out1<='0';

else

if(count=9)

then

count<=“0000”;

counter<=“0000”;

carry_out1<='1';

else

count<=count+1;

carry_out1<='0';

end if;

end if;end if;end process;daout(7 downto

4)<=counter;

daout(3

downto

0)<=count;enmin<=carry_out1 or setmin;end behav;6

4、alert程序: library ieee;

use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

entity alert is port(clkspk : in std_logic;

second : in std_logic_vector(7 downto 0);

minute : in std_logic_vector(7 downto 0);

speak : out std_logic;

lamp : out std_logic_vector(8 downto 0));end alert;

architecture behav of alert is signal divclkspk2 : std_logic;begin p1: process(clkspk)begin

if(clkspk'event and clkspk='1')then

divclkspk2<=not divclkspk2;

end if;end process;p2: process(second,minute)begin if(minute=“01011001”)then case second is

when “01010001”=>lamp<=“000000001”;speak<=divclkspk2;when “01010010”=>lamp<=“000000010”;speak<='0';when “01010011”=>lamp<=“000000100”;speak<=divclkspk2;when “01010100”=>lamp<=“000001000”;speak<='0';when “01010101”=>lamp<=“000010000”;speak<=divclkspk2;when “01010110”=>lamp<=“000100000”;speak<='0';when “01010111”=>lamp<=“001000000”;speak<=divclkspk2;when “01011000”=>lamp<=“010000000”;speak<='0';when “01011001”=>lamp<=“100000000”;speak<=clkspk;when others=>lamp<=“000000000”;end case;end if;end process;end behav;8

5、seltime程序 library ieee;

use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

entity seltime is port(ckdsp : in std_logic;

reset : in std_logic;

second : in std_logic_vector(7 downto 0);

minute : in std_logic_vector(7 downto 0);

hour : in std_logic_vector(7 downto 0);

daout : out std_logic_vector(3 downto 0);

sel : out std_logic_vector(2 downto 0));end seltime;

architecture behav of seltime is signal sec : std_logic_vector(2 downto 0);begin

process(reset,ckdsp)begin

if(reset='0')then sec<=“000”;

elsif(ckdsp'event and ckdsp='1')then

sec<=“000”;else

sec<=sec+1;end if;end if;end process;

process(sec,second,minute,hour)begin case sec is

when “000”=>daout<=second(3 downto 0);when “001”=>daout<=second(7 downto 4);when “011”=>daout<=minute(3 downto 0);when “100”=>daout<=minute(7 downto 4);when “110”=>daout<=hour(3 downto 0);when “111”=>daout<=hour(7 downto 4);when others=>daout<=“1111”;end case;end process;

if(sec=“111”)then

sel<=sec;end behav;

6、deled程序: LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_unsigned.all;

ENTITY deled IS PORT(S: IN STD_LOGIC_VECTOR(3 DOWNTO 0);

A,B,C,D,E,F,G,H: OUT STD_LOGIC);END deled;

ARCHITECTURE BEHAV OF deled IS

SIGNAL DATA:STD_LOGIC_VECTOR(3 DOWNTO 0);SIGNAL DOUT:STD_LOGIC_VECTOR(7 DOWNTO 0);BEGIN DATA<=S;PROCESS(DATA)BEGIN

CASE DATA IS

WHEN “0000”=>DOUT<=“00111111”;WHEN “0001”=>DOUT<=“00000110”;WHEN “0010”=>DOUT<=“01011011”;WHEN “0011”=>DOUT<=“01001111”;WHEN “0100”=>DOUT<=“01100110”;WHEN “0101”=>DOUT<=“01101101”;WHEN “0110”=>DOUT<=“01111101”;WHEN “0111”=>DOUT<=“00000111”;WHEN “1000”=>DOUT<=“01111111”;WHEN “1001”=>DOUT<=“01101111”;WHEN “1010”=>DOUT<=“01110111”;WHEN “1011”=>DOUT<=“01111100”;WHEN “1100”=>DOUT<=“00111001”;WHEN “1101”=>DOUT<=“01011110”;WHEN “1110”=>DOUT<=“01111001”;WHEN “1111”=>DOUT<=“01000000”;WHEN OTHERS=>DOUT<=“00000000”;END CASE;END PROCESS;H<=DOUT(7);

G<=DOUT(6);

F<=DOUT(5);

E<=DOUT(4);D<=DOUT(3);C<=DOUT(2);B<=DOUT(1);A<=DOUT(0);END BEHAV;

7、頂層原理圖:

四、實(shí)驗(yàn)結(jié)果 頂層原理圖仿真波形:

五、心得體會(huì)

1、系統(tǒng)設(shè)計(jì)進(jìn)要行充分的方案論證,不可盲目就動(dòng)手去做;

2、實(shí)驗(yàn)中對(duì)每一個(gè)細(xì)節(jié)部分都要全面思考,要對(duì)特殊情況進(jìn)行處理;

3、對(duì)于數(shù)字系統(tǒng),要考慮同步、異步問(wèn)題;

4、數(shù)字電路的理論分析要結(jié)合時(shí)序圖;

5、遇到問(wèn)題,要順藤摸瓜,分析清楚,不可胡亂改動(dòng),每做一次改變都要有充分的理由;

6、模塊化設(shè)計(jì)方法的優(yōu)點(diǎn)在于其簡(jiǎn)潔性,但是在實(shí)驗(yàn)設(shè)計(jì)中也發(fā)現(xiàn),在實(shí)驗(yàn)最終電路確定之前,要盡量減少模塊重疊嵌套,因?yàn)樵诳偟碾娐非枚ㄖ埃娐愤€不成熟,很多地方需要改進(jìn),如果在開(kāi)始時(shí)就進(jìn)行多層模塊化,里層模塊電路的修改將影響其外層的全部電路,這樣就是牽一發(fā)動(dòng)全身,很顯然,這樣將導(dǎo)致電 數(shù)字鐘課程設(shè)計(jì) 電路設(shè)計(jì)的低效,所以在設(shè)計(jì)過(guò)程中,一定要盡量減少超過(guò)兩層的模塊;

7、遇到問(wèn)題花了很長(zhǎng)時(shí)間沒(méi)有解決掉,要學(xué)會(huì)想他人請(qǐng)教,別人的不經(jīng)意一點(diǎn),可能就能把自己帶出思維死區(qū)。

下載EDA實(shí)現(xiàn)多功能數(shù)字鐘word格式文檔
下載EDA實(shí)現(xiàn)多功能數(shù)字鐘.doc
將本文檔下載到自己電腦,方便修改和收藏,請(qǐng)勿使用迅雷等下載。
點(diǎn)此處下載文檔

文檔為doc格式


聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻(xiàn)自行上傳,本網(wǎng)站不擁有所有權(quán),未作人工編輯處理,也不承擔(dān)相關(guān)法律責(zé)任。如果您發(fā)現(xiàn)有涉嫌版權(quán)的內(nèi)容,歡迎發(fā)送郵件至:645879355@qq.com 進(jìn)行舉報(bào),并提供相關(guān)證據(jù),工作人員會(huì)在5個(gè)工作日內(nèi)聯(lián)系你,一經(jīng)查實(shí),本站將立刻刪除涉嫌侵權(quán)內(nèi)容。

相關(guān)范文推薦

    EDA數(shù)字鐘畢業(yè)設(shè)計(jì)

    [ 標(biāo)簽:數(shù)字鐘, eda ]1、設(shè)計(jì)一個(gè)能顯示1/10秒、秒、分、時(shí)的12小時(shí)數(shù)字鐘。 2、時(shí)鐘源使用頻率為0.1Hz的連續(xù)脈沖。 3、設(shè)置兩個(gè)按鈕,一個(gè)供“開(kāi)始”及“停止”用,一個(gè)供系統(tǒng)......

    eda數(shù)字鐘程序

    LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY clock IS PORT (EN :IN STD_LOGIC;數(shù)碼管使能 CL......

    EDA數(shù)字鐘課程設(shè)計(jì)

    課 程 設(shè) 計(jì) 報(bào) 告 設(shè)計(jì)題目:用VHDL語(yǔ)言實(shí)現(xiàn)數(shù)字鐘的設(shè)計(jì) 班 級(jí):電子1002班 學(xué) 號(hào):20102625 姓 名:于曉 指導(dǎo)教師:李世平、李寧 設(shè)計(jì)時(shí)間:2012年12月摘要 數(shù)字鐘是一種用數(shù)字電路......

    多功能數(shù)字鐘(5篇)

    課程設(shè)計(jì)任務(wù)書(shū)學(xué)生姓名:專(zhuān)業(yè)班級(jí):指導(dǎo)教師:工作單位:題目:多功能數(shù)字鐘的設(shè)計(jì)與實(shí)現(xiàn)初始條件: 本設(shè)計(jì)既可以使用集成譯碼器、計(jì)數(shù)器、定時(shí)器、脈沖發(fā)生器和必要的門(mén)電路等,也可以......

    多功能數(shù)字鐘課程設(shè)計(jì)

    多功能數(shù)字鐘 朱安煙 (安陽(yáng)師范學(xué)院 物電學(xué)院, 河南 安陽(yáng) 455002) 摘要:時(shí)鐘相比具有更高的準(zhǔn)確性和直觀性 因此得到了更加廣泛的使用。 數(shù)字鐘從原理上講是一種典型的數(shù)字電路......

    多功能數(shù)字鐘設(shè)計(jì)

    課程設(shè)計(jì)任務(wù)書(shū)課程設(shè)計(jì)名稱學(xué)生姓名專(zhuān)業(yè)班級(jí)設(shè)計(jì)題目多功能數(shù)字鐘設(shè)計(jì) 一、 課程設(shè)計(jì)目的 1、綜合運(yùn)用EDA技術(shù),獨(dú)立完成一個(gè)課題的設(shè)計(jì),考察運(yùn)用所學(xué)知識(shí),解決實(shí)際問(wèn)題的能力;......

    多功能數(shù)字鐘課程設(shè)計(jì)報(bào)告

    課題名稱 姓名 學(xué)號(hào) 院、系、部 專(zhuān)業(yè) 指導(dǎo)教師電子技術(shù)課程設(shè)計(jì)報(bào)告書(shū) 2016年6月12日一、設(shè)計(jì)任務(wù)及要求: 用中小規(guī)模集成芯片設(shè)計(jì)并制作多功能數(shù)字鐘,具體要求如下: 1、準(zhǔn)確及......

    FPGA課程設(shè)計(jì)多功能數(shù)字鐘講解

    多功能數(shù)字鐘 開(kāi)課學(xué)期:2014—2015 學(xué)年第二學(xué)期 課程名稱: FPGA課程設(shè)計(jì)學(xué) 院: 信息科學(xué)與工程學(xué)院專(zhuān) 業(yè): 集成電路設(shè)計(jì)與集成系統(tǒng)班 級(jí): 學(xué) 號(hào): 姓 名: 任課教師: 2015 年 7......

主站蜘蛛池模板: 久久精品国产丝袜人妻| 日本亚欧热亚洲乱色视频| 午夜在线不卡精品国产| 狠狠色噜噜狠狠狠狠色综合久| 99久久亚洲综合精品成人网| 亚洲午夜久久久影院伊人| 成人免费无码大片a毛片抽搐| 精品熟女少妇av免费观看| 亚洲精品乱拍国产一区二区三区| 亚洲国产美女精品久久久久∴| 韩日午夜在线资源一区二区| 国产乱子伦一区二区三区视频播放| 少妇高清精品毛片在线视频| 天天躁日日躁狠狠躁av中文| 国产精品成人午夜电影| 亚洲aⅴ无码专区在线观看q| 久久不见久久见www电影免费| 国产av一区二区三区最新精品| 中文字幕美人妻亅u乚一596| 国产av综合影院| 久久久久亚洲精品无码网址| 国产破外女出血视频| 国产mv在线天堂mv免费观看| 国产成网站18禁止久久影院| 国产免码va在线观看免费| 韩国精品福利一区二区三区| 精品久久久久久中文字幕无码vr| 国产大陆xxxx做受视频| 日本理伦片午夜理伦片| 国产av综合影院| 朝鲜美女黑毛bbw| 伦人伦xxxx国语对白| 84pao国产成视频永久免费| 无码丰满熟妇浪潮一区二区av| 97精品尹人久久大香线蕉| 成人又黄又爽又色的网站| 老汉老妇姓交视频| 无码手机线免费观看| 无码成人1000部免费视频| 国产精品久久久久9999无码| 中文字幕乱码人妻二区三区|