




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、 電子科技大學(xué)光電信息學(xué)院課程設(shè)計論文 課程名稱 現(xiàn)代電子技術(shù)綜合實驗 題目名稱 基于vhdl語言的fpga智能搶答器設(shè)計論文 學(xué) 號 姓 名 指導(dǎo)老師 陳學(xué)英 起止時間 11月11日-11月22日 2013年 11月 21日摘要 智力搶答器作為一種快速準確判斷選手搶答先后的比賽工具,現(xiàn)如今經(jīng)常出現(xiàn)各類智力搶答,競猜類比賽中。本文利用fpga開發(fā)平臺為基礎(chǔ),以vhdl語言進行編程,在ise軟件上進行開發(fā),實現(xiàn)電視中比賽選手搶答器的各項功能。其中,第二章簡單介紹fpga開發(fā)平臺的特點、vhdl語言的特點,以及大體的開發(fā)流程。第三章主要介紹了開發(fā)軟件ise和仿真軟件modelsim的使用。第四章主
2、要介紹智力搶答器的具體設(shè)計過程、原理設(shè)計、模塊化設(shè)計。第五章主要對各個模塊進行仿真測試,以及對最后的整個系統(tǒng)進行仿真測試。最后第六章,在基于整個系統(tǒng)仿真無誤的前提下進行硬件編程下載,在實驗硬件平臺上測試設(shè)計結(jié)果和智力搶答器的實用性。并對這次試驗進行總結(jié)。目錄一、實驗?zāi)康亩嶒炄蝿?wù)與要求三、實驗原理、設(shè)計思路與方案四、單元模塊設(shè)計與仿真模塊功能、模塊符號及端口說明、模塊程序、仿真程序、仿真波形五、系統(tǒng)模塊設(shè)計 頂層模塊設(shè)計、系統(tǒng)管腳適配表、編程文件、下載成功標志、硬件調(diào)試說明六、結(jié)論 1、 實驗?zāi)康?在許多比賽活動中,為了準確、公正、直觀地判斷出第一搶答者,通常設(shè)置一臺搶答器。通過搶答器的數(shù)顯
3、,燈光和音響等手段指示出第一搶答者。同時還可以設(shè)置定時、記分犯規(guī)及獎懲等多種功能。本設(shè)計采用手動搶答的方式,有人搶答后,系統(tǒng)自動封鎖其他人的搶答按鈕,使其不能再搶答,從而實現(xiàn)搶答功能。2、 實驗任務(wù)與要求1.基本要求(1)、編號16號的選手在規(guī)定的時間內(nèi)按鍵搶答(2)、搶中編號鎖定顯示,其他無效(3)、主持按鍵控制清零和開始(4)、具有報警提示功能,分別提示搶答開始,有人搶答,定時時間到2.參數(shù)要求(1)、顯示組數(shù):6組(2)、報警延時:300ms(3)、搶答時間:20s3、 實驗原理、設(shè)計思路與方案 搶答信號輸入系統(tǒng)后,系統(tǒng)必須對最先搶到的選手進行編碼,而后鎖存這個編碼,并將這個編碼顯示輸出
4、,所以需要用到編碼器、鎖存器和譯碼顯示電路。而選手搶答的有效時間為20s,而且系統(tǒng)在有人搶中,主持人按下開關(guān)以及20s計時到但無人搶答時這三種情況下要發(fā)出警報,且警報時間延遲300ms后自動停止,故需定時電路來確定這些時限,報警電路產(chǎn)生時延,并用時序控制電路來協(xié)調(diào)各個部分的工作,計時時間也要顯示出來。 當主持人按鍵為啟動開始狀態(tài)時,警報器發(fā)出警報,搶答編碼電路進入工作狀態(tài),選手可以進行搶答。同時搶答定時電路開始從20s遞減,顯示器顯示遞減,顯示器顯示遞減的時間,當時間未減少到0s時,有選手搶答,報警電路發(fā)出警報,顯示器顯示選手編號,并鎖存該選手的號碼直到主持人清零為止,此時搶答器的時間不再遞減
5、;當時間減到0s時,無選手搶答,報警電路發(fā)出警報,提示選手不能再搶答,顯示器顯示搶答時間0s不動,選手號碼為無效號碼或者f。當主持人按下清零信號,系統(tǒng)顯示為初始狀態(tài)。四、單元模塊設(shè)計與仿真1.單元電路的劃分 根據(jù)搶答器所需要實現(xiàn)的功能,將整體電路劃分為:編碼鎖存電路(bmsc)、搶答定時電路(dsq)、報警器電路(bjq)、掃描顯示電路(scan)、譯碼電路(ymq)和按鍵消抖(xd)六個單元電路。2.1編碼鎖存電路(bmsc):(1) 該電路主要實現(xiàn)的功能是:當主持人啟動開始鍵,系統(tǒng)進入工作狀態(tài),同時48mhz時鐘上升沿持續(xù)掃描6個選手的按鍵端口。當?shù)褂嫊r未到0,有選手搶答時,則對該選手的按
6、鍵進行編碼,并鎖存該選手編碼并將其輸出,同時其他選手的按鍵搶答無效。若無選手搶答,則持續(xù)掃描,直至下一輪搶答開始。本電路共有6個端口。4個輸入端口:系統(tǒng)時鐘、開始按鍵信號、定時時間到信號、選手搶答按鍵信號。2個輸出端口:選手按鍵編碼信號、有選手搶中信號。(2) 模塊程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;- uncomment the following library declaration if instantiating
7、- any xilinx primitives in this code.-library unisim;-use unisim.vcomponents.all;entity bmsc is port ( clk : in std_logic; start : in std_logic; sjd : in std_logic; xs : in std_logic_vector (5 downto 0); s : out std_logic_vector (3 downto 0); qz : out std_logic );end bmsc;architecture behavioral of
8、bmsc issignal q_z:std_logic;signal en:std_logic:=0;signal q:std_logic_vector(3 downto 0):=0000;beginstate:process(start) begin if start event and start =0 then en q = 0001; q_z q = 0010; q_z q = 0011; q_z q = 0100; q_z q = 0101; q_z q = 0110; q_z q =0000; end case; end if ; else q =0000; q_z =1; end
9、 if ; end if ; end process; s = q; qz 0);-outputssignal s : std_logic_vector(3 downto 0);signal qz : std_logic;begin- instantiate the unit under test (uut)uut: bmsc port map(clk = clk,start = start,sjd = sjd,xs = xs,s = s,qz = qz);tb : processbegin clk=0; wait for 100 ps;clk=1; wait for 100 ps;end p
10、rocess; stm: process begin start=1; xs=111111; sjd=1; wait for 50 ns ;start=0;wait for 100 ns;start=1;wait for 200 ns;xs=111101;wait for 200 ns;xs=110111;wait for 300 ns;start=0;wait for 100 ns;start=1;xs=111111;wait for 500 ns ;start=0;wait for 200 ns;start=1;wait for 100 ns;sjd=0;wait for 300 ns;x
11、s=011111;wait for 200 ns;end process;end; bmsc仿真波形 2.2定時電路(dsq)(1)該電路主要實現(xiàn)的功能是:規(guī)定20秒倒計時時間。本模塊共有5個端口,3個輸入端口:基準時間源,開始鍵信號,選手搶中信號;兩個輸出端口:時間到報警信號和實時計數(shù)輸出端口。 為了實現(xiàn)按秒計時,首先要設(shè)計一個分頻器來計算1hz的標準時間信號。(2) 模塊程序- company: - engineer: - - create date: 20:53:24 11/13/2013 - design name: - module name: dsp - behavioral -
12、project name: - target devices: - tool versions: - description: - dependencies: - revision: - revision 0.01 - file created- additional comments: -library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;- uncomment the following library declaration if ins
13、tantiating- any xilinx primitives in this code.-library unisim;-use unisim.vcomponents.all;entity dsp isport(clk:in std_logic; qz:in std_logic; start:in std_logic; sjd:out std_logic; t10:out std_logic_vector(3 downto 0); t0:out std_logic_vector(3 downto 0);end dsp;architecture behavioral of dsp issi
14、gnal cnt:integer range 1 to 24000000:=1;signal clk_1hz:std_logic:=1;signal en:std_logic:=0;signal m10,m0:std_logic_vector(3 downto 0);beginfp:process(clk) is begin if clk event and clk=1 then if cnt=24000000 then cnt =1;clk_1hz =not clk_1hz;else cnt =cnt+1;end if; end if;end process;state:process(st
15、art) begin if start event and start=0 then en = not en;end if;end process;jsq:process(en,qz,clk_1hz) is begin if en=0 then m10 =0010;m0=0000;sjd=1;elsif clk_1hz event and clk_1hz=1 then if qz=1 then if m10=0 and m0=0 then m10=0000;m0=0000; sjd=0; else if m0=0 and m10/=0 then m0=1001;m10 =m10-1; else
16、 m0 = m0-1;end if;end if;end if;end if;end process;t0 = m0;t10 clk,qz = qz,start = start,sjd = sjd,t10 = t10,t0 = t0);tb : processbegin clk=0; wait for 10 ns;clk=1; wait for 10 ns;end process; stim : processbegin start=1;qz=1; wait for 100 ns; start=0; wait for 100 ns; start=1; wait for 1100 us; sta
17、rt=0; wait for 100 ns; start=1; wait for 100 us; start=0; wait for 100 ns; start=1; wait for 200 us; qz=0; wait for 100 us; start=0; wait for 100 ns; start=1; wait for 100 us; end process;end; dsq仿真波形2.3報警電路(bjq)(1)該電路主要實現(xiàn)的功能是:在開始鍵按下、有選手搶答、計時時間到這三種情況下,報警器發(fā)出警報,警報延時(學(xué)號+300)ms后結(jié)束。 本電路共有5個端口。4個輸入端口:基準時間
18、源信號、開始鍵信號、選手搶中信號、時間到信號。1個輸出端口:報警信號。三路報警觸發(fā)信號最終要通過一個與門來進行整合。(2)模塊程序- company: - engineer: - - create date: 20:55:37 11/13/2013 - design name: - module name: bjq - behavioral - project name: - target devices: - tool versions: - description: - dependencies: - revision: - revision 0.01 - file created- ad
19、ditional comments: -library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;- uncomment the following library declaration if instantiating- any xilinx primitives in this code.-library unisim;-use unisim.vcomponents.all;entity bjq isport(clk:in std_logic;
20、qz,sjd,start:in std_logic;bj:out std_logic);end bjq;architecture behavioral of bjq issignal bj1,bj2,bj3:std_logic;signal en:std_logic:=0;beginstate:process(start)beginif start event and start=0 thenen = not en;end if;end process;t1:process(clk,en)variable q:integer range 1 to 14400000:=1;beginif en=
21、0 thenbj1 =1; q:=1;elseif clk event and clk=1 thenif q=14400000 thenbj1 =1;elseq:=q+1;bj1=0;end if;end if;end if;end process;t2:process(clk,qz)variable q:integer range 1 to 14400000:=1;beginif qz=1 thenbj2 =1; q:=1;elseif clk event and clk=1 thenif q=14400000 thenbj2 =1;elseq:=q+1;bj2 =0;end if;end
22、if;end if;end process;t3:process(clk,sjd)variable q:integer range 1 to 14400000:=1;beginif sjd=1 thenbj3=1;q:=1;elseif clk event and clk=1 thenif q=14400000 thenbj3 =1;elseq:=q+1;bj3 =0;end if;end if;end if;end process;bj clk,qz = qz,sjd = sjd,start = start,bj = bj);tb : processbegin clk=0;wait for
23、10 ns;clk=1;wait for 10 ns;end process; stm_proc : processbegin start=1; qz=1; sjd=1; wait for 50 ns; start =0;wait for 100 ns; start =1;wait for 150 ms; qz=0;wait for 200 ms; sjd=0;wait for 280 ms; start=0;wait for 100 ns; start=1;wait for 1 ms;end process;end;bjq仿真波形2.4掃描顯示電路(scan)(1)該電路主要實現(xiàn)的功能是:對
24、倒計時時間和搶到的選手號碼進行顯示。本電路共有6個端口。4個輸入端口:系統(tǒng)時鐘、選手號碼、時間十位數(shù)據(jù)、時間個位數(shù)據(jù);2個輸出端口:輸出的三位掃描信號,顯示數(shù)據(jù)信號。(2) 模塊程序- company: - engineer: - - create date: 20:57:27 11/13/2013 - design name: - module name: scan - behavioral - project name: - target devices: - tool versions: - description: - dependencies: - revision: - revis
25、ion 0.01 - file created- additional comments: -library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;- uncomment the following library declaration if instantiating- any xilinx primitives in this code.-library unisim;-use unisim.vcomponents.all;entity s
26、can isport ( clk : in std_logic; s : in std_logic_vector (3 downto 0); t10 : in std_logic_vector (3 downto 0); t0 : in std_logic_vector (3 downto 0); dig : out std_logic_vector (2 downto 0); dout : out std_logic_vector (3 downto 0);end scan;architecture behavioral of scan issignal cnt:integer range
27、1 to 24000:=1;signal clk1k:std_logic:=0;signal q:std_logic_vector(2 downto 0):=000;beginprocess(clk)beginif clkevent and clk=1 thenif cnt=24000 thencnt=1;clk1k=not clk1k;elsecnt=cnt+1;end if;end if;end process;process(clk1k)beginif clk1k event and clk1k=1 thenif q=111 thenq=000;elseqdout dout dout d
28、out =1111;end case;end process;dig0);signal t10 : std_logic_vector(3 downto 0) := (others=0);signal t0 : std_logic_vector(3 downto 0) := (others=0);-outputssignal dig : std_logic_vector(2 downto 0);signal dout : std_logic_vector(3 downto 0);begin- instantiate the unit under test (uut)uut: scan port map(clk = clk,s = s,t10 = t10,t0 = t0,dig = dig,dout = dout);tb : processbegin clk=0; wait fo
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2020-2021深圳育才中學(xué)(初中)小學(xué)三年級數(shù)學(xué)下期末一模試卷帶答案
- 安裝鐵塔施工方案
- 2024年黑龍江大慶中考滿分作文《詩中誦出赤子心》
- 個人購銷合同范例范例
- 修路個人勞務(wù)合同范例
- 合伙餐廳合同范本
- 跨部門合作的工作計劃實例
- 鄉(xiāng)村樹苗銷售合同范例
- 學(xué)生自我管理與目標追蹤計劃
- 培養(yǎng)員工潛能與激勵方式計劃
- 2023年貴州貴州貴安發(fā)展集團有限公司招聘筆試真題
- 福建省漳州市2023-2024學(xué)年高二上學(xué)期期末考試化學(xué)試題 含答案
- 初中數(shù)學(xué)新課程標準(2024年版)
- 煤礦危險源辨識和風(fēng)險考核試卷
- 科學(xué)計算語言Julia及MWORKS實踐 課件 4-Syslab簡介
- 新能源汽車三電系統(tǒng)培訓(xùn)教材
- 2024機械車間裝配作業(yè)指導(dǎo)書
- 城市污水處理廠改造施工方案
- 八項規(guī)定解讀
- 2024年高等教育法學(xué)類自考-00369警察倫理學(xué)考試近5年真題集錦(頻考類試題)帶答案
- 礦山開采居間合作協(xié)議書范文
評論
0/150
提交評論