EDA課程設計報告電子搶答器_第1頁
EDA課程設計報告電子搶答器_第2頁
EDA課程設計報告電子搶答器_第3頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、得分:課程設計報告電子搶答器設計課程:可編程器件及使用課程設計班級:學號:姓名:指導教師:2011年 月 日目錄1課題背景 31.1 設計的目的31.2 系統(tǒng)功能及要求 32程序功能模塊組成及流程圖 42.1 程序功能模塊組成 42.2 程序流程圖43程序代碼及模塊分析 44運行結(jié)果 125實驗現(xiàn)象16 6總結(jié)和體會1 .課題背景EDA 及電子設計自動化,是指使用計算機自動完成電子系統(tǒng)的設計,使用EDA 技術(shù)進行電子產(chǎn)品的設計已成為當今電子工程師的一項基本技。隨著電子 技術(shù)和計算機技術(shù)的飛速發(fā)展, 新的高度集成的電子設計方法不斷推出, 電子產(chǎn) 品的性能越來越高, 更新的速度也越來越快, 和此同

2、時, 市場對電子產(chǎn)品的設計 提出了更為嚴格的要求,從而促進了電子設計自動化( EDA )技術(shù)的迅速發(fā)展 在多項競賽及節(jié)目上都用到電子搶答器,他們搶答所使用的搶答器就是我 這次要做的課程設計的內(nèi)容。有了搶答器會使選手間更加公平、公正、公開,也 方便了主持人對現(xiàn)場的主持。1.1 設計的目的本次課程設計的目的是在學習完 EDA 課程的基礎上,運用 EDA 的知識即 VHDL 語言,編寫程序來實現(xiàn)此次我設計的電子搶答器所要實現(xiàn)的功能,不僅會 編寫程序,還要能夠在實驗室中檢測我所編寫的程序是否能夠達到預期的目的。1.2 系統(tǒng)功能及要求(1)優(yōu)先編碼器電路立即分辨出搶答者編號,并由鎖存器進行鎖存,然后 由

3、譯碼顯示電路顯示編號;(2)揚聲器發(fā)出短暫聲響,提醒主持人注意;(3)控制電路要對輸入編碼電路進行封鎖,避免其他選手再次進行搶答;(4)當選手將問題回答完畢,主持人操作計分開關,計分電路采用十進制 加/ 減計數(shù)器、數(shù)碼管顯示。本輪搶答完畢,主持人操作控制開關,使系統(tǒng) 回復到禁止工作狀態(tài),以便進行下一輪搶答。2程序功能模塊組成及流程圖2.1 程序功能模塊組成本程序主要設計了七個模塊,分別是:1. 搶答鑒別模塊2. 計時模塊3. 數(shù)據(jù)選擇模塊4. 報警模塊5. 譯碼模塊6. 計分模塊7. 控制模塊2.2 程序流程圖3.程序代碼及模塊分析3.1搶答鑒別模塊鑒別鎖存模塊的關鍵是準確判斷出第一搶答者并將

4、其鎖存,實現(xiàn)的方法可 使用觸發(fā)器或鎖存器,在得到第一信號后將輸入封鎖,使其它組的搶答信號 無效。形成第一搶答信號后,用編碼、譯碼及數(shù)碼顯示電路顯示第一搶答者 的組號并啟動答題計時電路。搶答鑒別電路可以由VHDL程序來實現(xiàn),以下是一斷搶答鑒別的 VHDL程 序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all; en tity ide ntify isport(ret,clk:in std_logic;a0,a1,a2,a3:in stdo gic;states:buffer std_logic

5、_vector(3 downto 0);tmp:out stdo gic);end ide ntify;architecture behav of ide ntify is signal st:stdogic_vector(3 downto 0); begi n process(clk , ret,a0, a1,a2,a3)begi nif ret=1 then tmp=0;st=0000;elsif clkeve nt and clk=1 the nif (a0=1 or st(0)=1)and not( st(1)=1 or st(2)=1 or st(3)=1 ) thenst(0)=1

6、;end if ;the nif (a1=1 or st(1)=1)a nd not( st(0)=1 or st(2)=1 or st( 3)=1)st(1)=1;end if ;if (a2=1 or st(2)=1)and not( st(0)=1 or st(1)=1 or st(3)=1 )thenst(2)=1;end if ;if (a3=1 or st(3)=1)and not( st(0)=1 or st(1)=1 or st(2)=1 ) then st(3)=1;end if ;tmp=st(0) or st(1) or st(2) or st(3);end if ;en

7、d process;process(states(0),states(1),states(2),states(3)beginif (st=0000) then states=0000;elsif (st=0001) then states=0001;elsif (st=0010) then states=0010;elsif (st=0100) then states=0011;elsif (st=1000) then states=0100;end if;end process;end behav;3.2 計時模塊搶答計時模塊的任務是當主持人啟動這個計時開關時開始計時, 如果在規(guī)定 的時間內(nèi)

8、答完題則答題有效, 如果在規(guī)定的時間內(nèi)沒有完成, 則答題無效。 計時 器從規(guī)定的時間倒計時,計時為零時計時結(jié)束。答題有無效作憑主持人來判斷。計時電路可以由 VHDL 程序來實現(xiàn),以下是一段計時的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity timed is port(clk,ret,sin:in std_logic; time1,time2:buffer std_logic_vector(3 downto 0); warningg:out std_logic);e

9、nd timed ; architecture behav of timed is signal co:std_logic;begin process(clk,ret,sin,time1) begin if ret=1 then time1=0000;elsif clkevent and clk1=1 then co=0;if sin=1 thenif time1=0000 then time1=1001;co=1; else time1=time1-1;end if;end if;end if; end process ;process(co,ret,sin,time2) begin if

10、ret=1 then time2=0010;elsif coevent and co=1 thenif sin=1 thenif time2=0000 then time2=0010; else timee2=time2-1;end if;end if;end if;if(time1=0000 and time2=0000) then warning=1;else warning=0; end if;end process;end behav;3.3 數(shù)據(jù)選擇模塊輸入三路信號,上升沿到來時count加一,當count= “00 “時,選擇ini路信; 當count= “01 “時,選擇in2路

11、信號;當count= “ 10 “時,選擇c路信號;等于 其他信號時無操作。數(shù)據(jù)選擇電路可以由 VHDL 程序來實現(xiàn), 以下是一段數(shù)據(jù)選擇的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity selecte isport (in1,in2,in3: in std_logic_vector(3 downto 0);clk,ret: instd_logic;s: outstd_logic_vector(1 downt

12、o 0);y: out std_logic_vector(3 downto 0) ); end selecte;architecture behav of selecte issignal count: std_logic_vector (1 downto 0);begins=count;process(clk,ret)beginif(ret=1)then count=10)then count=00;else countyyynull;end case;end process ;end behav;3.4 報警模塊 當輸入信號無效或超時時就啟動報警模塊計。 報警電路可以由 VHDL 程序來實

13、現(xiàn),以下是一段報警的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity reporte is port(clk,l:in std_logic;q:out std_logic);end reporte;architecture behav of reporte is beginprocess(l,clk)beginif l=0 thenq =0; elsif l=1 then qdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=0

14、000000;end case;end process;end behav;3.6 計分模塊當選手回答完畢后, 主持人判斷是否正確, 酌情加分, 若回答正確,加一分, 否則不加分,也不減分。計分電路可以由 VHDL 程序來實現(xiàn),以下是一段計分的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity jf isport(q:in bit;count:out std_logic_vector(3 downto 0); e

15、nd jf;architecture behav of jf issignal temp:std_logic_vector(3 downto 0):=0000; beginprocess(q) beginif(q=1)thentemp=temp+1;end if;end process;count=temp;end behav;3.7 控制模塊輸入兩路信號a和b, b= O時,將a輸出,否則輸出 0??刂齐娐房梢杂?VHDL 程序來實現(xiàn),以下是一段控制的 VHDL 程序:ibrary ieee ;use ieee.std_logic_1164.all;use ieee.std_logic_un

16、signed.all;entity manage isport ( a,b:in std_logic;);end man age;architecture behav of man age is begi nprocess(b,a)beg inif b=1 then c=0;elsif b=0 the n c=a;end if;end process;end behav;4.運行結(jié)果1.搶答鑒別模塊仿真圖Master Time Bar18.025 ns *1 Patitei:339 ps IrrtazM:17.69 r SlaitEnd:h-ntleId1 -S *2.計時模塊仿真圖_ster

17、 Time Bar13.025 ns* * Pcimei:2B.17nsInteivaft10.15 n&SlitEndb妙亡Volu.4-9B. 0210 9 n= 曲 血9 九三?115 so-9n= 60 ?TO-9 n= e v115A3130*13elk* IF&tK iSLIh丸timeUA Llint2A k iIB. 025 ns dIII創(chuàng)x區(qū)ix【丁】xr 【幻 丫 X x何-1tn113.數(shù)據(jù)選擇模塊仿真圖faster Time Bai:19.025nPcirter:261 m Intervat-15.42 ns Start:Endt4.報警模塊仿真圖11 a.tioei

18、 node: functiqh-lLMarfff Tr*|jyj和y -Refwrt -隕 E1& F?e E#ii護幘記 prat-wa Iwh 土問葉 出歸.旦.J. HQsfa s-3 H2 W 怡比專醫(yī)& *| 令Ripcri - Fk*Sumwr佃5 HA心3m打 ir*H. Jr| INI I Jug d MnuaRiKzr-kMieiia-Eml切CMbirrhlLfUl13i.rii.iE 1 ALTQ一昏jW1 IT$3HdALUL bf! Fwcmiud4ihan 関 Rpi gd NotEi lew Sun me | &unvnw*i |MJ01H inV4fsj In-, afld 15X 1

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 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

提交評論