基于EDA搶答器的設(shè)計(jì)_第1頁
基于EDA搶答器的設(shè)計(jì)_第2頁
基于EDA搶答器的設(shè)計(jì)_第3頁
基于EDA搶答器的設(shè)計(jì)_第4頁
基于EDA搶答器的設(shè)計(jì)_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、eda技術(shù)綜合設(shè)計(jì)課程設(shè)計(jì)報(bào)告報(bào) 告 題 目: 基于vhdl的四路搶答器 作者所在系部: 電子工程系 作者所在專業(yè): 自動化 作者所在班級: b07221 作 者 姓 名 : xxx 指導(dǎo)教師姓名: xxx 完 成 時(shí) 間 : 2009-11-29 內(nèi) 容 摘 要搶答器是為智力競賽參賽者答題時(shí)進(jìn)行搶答而設(shè)計(jì)的一種優(yōu)先判決器電路,競賽者可以分為若干組,搶答時(shí)各組對主持人提出的問題要在最短的時(shí)間內(nèi)做出判斷,并按下?lián)尨鸢存I回答問題。當(dāng)?shù)谝粋€(gè)人按下按鍵后,則在顯示器上顯示該組的號碼,同時(shí)電路將其他各組按鍵封鎖,使其不起作用。若搶答時(shí)間內(nèi)無人搶答,警報(bào)器發(fā)出警報(bào)?;卮鹜陠栴}后,由主持人將所有按鍵恢復(fù),重

2、新開始下一輪搶答。因此要完成搶答器的邏輯功能,該電路至少應(yīng)包括搶答鑒別模塊、分頻器、計(jì)時(shí)模塊、選擇控制和報(bào)警器組成。關(guān)鍵詞:搶答鑒別 封鎖 計(jì)時(shí) 報(bào)警目 錄一 概 述 5二 方案設(shè)計(jì)與論證5三 單元電路設(shè)計(jì)5 3.1. 搶答鑒別模塊的設(shè)計(jì) 53.2 計(jì)時(shí)模塊的設(shè)計(jì) 7 3.3 數(shù)據(jù)選擇模塊的設(shè)計(jì) 83.4 報(bào)警模塊的設(shè)計(jì) 103.5 譯碼器模塊的設(shè)計(jì) 123.6 分頻模塊 123.7 搶答器頂層文件的設(shè)計(jì) 133.8 主電路連線圖 153.9 芯片引腳圖 16四 器件編程與下載16五 性能測試與分析16六 實(shí)驗(yàn)設(shè)備16七 心得體會17八 參考文獻(xiàn)17程序設(shè)計(jì)流程圖層次化設(shè)計(jì)圖形輸入文本輸入建立

3、項(xiàng)目文件設(shè)計(jì)器件增益邏輯正確仿真分析引腳分配重新調(diào)整設(shè)計(jì)正確生成下載文件下載并驗(yàn)證nonoyesyes設(shè)計(jì)輸入設(shè)計(jì)生成設(shè)計(jì)實(shí)現(xiàn)硬件下載一、概述 搶答器的邏輯結(jié)構(gòu)較簡單,它主要由搶答鑒別模塊、分頻器、計(jì)時(shí)模塊、選擇控制和報(bào)警器組成。在整個(gè)搶答器中最關(guān)鍵的是如何實(shí)現(xiàn)搶答封鎖,在控制鍵按下的同時(shí)計(jì)數(shù)器倒計(jì)時(shí)顯示有效剩余時(shí)間。除此之外,整個(gè)搶答器還需有一個(gè)使能信號和一個(gè)歸零信號,以便搶答器能實(shí)現(xiàn)公平搶答和停止。搶答器共有3個(gè)輸出顯示,選手代號、計(jì)數(shù)器的個(gè)位和十位,他們輸出全都為bcd碼輸出,這樣便于和顯示譯碼器連接。當(dāng)主持人按下控制鍵、選手按下?lián)尨疰I或倒計(jì)時(shí)到時(shí)蜂鳴器短暫響起。二、方案設(shè)計(jì)與論證將該任

4、務(wù)分成七個(gè)模塊進(jìn)行設(shè)計(jì),分別為:搶答器鑒別模塊、搶答器計(jì)時(shí)模塊、搶答器記分模塊、分頻模塊、譯碼模塊、數(shù)選模塊、報(bào)警模塊,最后是撰寫頂層文件。1、 搶答器鑒別模塊:在這個(gè)模塊中主要實(shí)現(xiàn)搶答過程中的搶答功能,并能對超前搶答進(jìn)行警告,還能記錄無論是正常搶答還是朝前搶答者的臺號,并且能實(shí)現(xiàn)當(dāng)有一路搶答按鍵按下時(shí),該路搶答信號將其余個(gè)綠搶答封鎖的功能。其中有四個(gè)搶答信號s0、s1、s2、s3;搶答使能信號s;搶答狀態(tài)顯示信號states;搶答與警報(bào)時(shí)鐘信號clk2;系統(tǒng)復(fù)位信號rst;警報(bào)信號tmp。2、 搶答器計(jì)時(shí)模塊:在這個(gè)模塊中主要實(shí)現(xiàn)搶答過程中的計(jì)時(shí)功能,在有搶答開始后進(jìn)行30秒的倒計(jì)時(shí),并且在

5、30秒倒計(jì)時(shí)后無人搶答顯示超時(shí)并報(bào)警。其中有搶答時(shí)鐘信號clk2;系統(tǒng)復(fù)位信號rst;搶答使能信號s;搶答狀態(tài)顯示信號states;無人搶答警報(bào)信號warn;計(jì)時(shí)中止信號stop;計(jì)時(shí)十位和個(gè)位信號tb,ta。3、 數(shù)據(jù)選擇模塊:在這個(gè)模塊中主要實(shí)現(xiàn)搶答過程中的數(shù)據(jù)輸入功能,輸入信號a3.0、b3.0、c3.0;計(jì)數(shù)輸出信號s;數(shù)據(jù)輸出信號y;計(jì)數(shù)脈沖clk2,實(shí)現(xiàn)a、b、c按脈沖輪流選通,在數(shù)碼管上顯示。4、 報(bào)警模塊: 在這個(gè)模塊中主要實(shí)現(xiàn)搶答過程中的報(bào)警功能,當(dāng)主持人按下控制鍵,有限時(shí)間內(nèi) 人搶答或是計(jì)數(shù)到時(shí)蜂鳴器開始報(bào)警,有效電平輸入信號i;狀態(tài)輸出信號q;計(jì)數(shù)脈沖clk2。5、 譯碼

6、模塊:在這個(gè)模塊中主要實(shí)現(xiàn)搶答過程中將bcd碼轉(zhuǎn)換成7段的功能。6、 分頻模塊:在這個(gè)模塊中主要實(shí)現(xiàn)搶答過程中實(shí)現(xiàn)輸出雙脈沖的功能。7、 頂層文件:在這個(gè)模塊中是對前七個(gè)模塊的綜合編寫的頂層文件。三、單元電路設(shè)計(jì)(一)搶答鑒別模塊 1、vhdl源程序library ieee;-搶答鑒別模塊use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity qdjb is port(rst,clk2:in std_logic; s0,s1,s2,s3:in std_logic; states:buffer std_logic_ve

7、ctor(3 downto 0);tmp:out std_logic);end qdjb;architecture one of qdjb issignal st:std_logic_vector(3 downto 0);beginp1:process(s0,rst,s1,s2,s3,clk2) begin if rst='0' then tmp<='0'st<="0000" elsif clk2'event and clk2='1' then if (s0='1' or st(0)=

8、9;1')and not( st(1)='1' or st(2)='1' or st(3)='1' ) then st(0)<='1' end if ; if (s1='1' or st(1)='1')and not( st(0)='1' or st(2)='1' or st(3)='1' ) then st(1)<='1' end if ; if (s2='1' or st(2)='1

9、9;)and not( st(0)='1' or st(1)='1' or st(3)='1' ) then st(2)<='1' end if ; if (s3='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<=s0 or s1 or s2 or s3;end if ;end pro

10、cess p1;p2:process(states(0),states(1),states(2),states(3) begin if (st="0000") then states<="0000" elsif (st<="0001") then states<="0001"elsif (st<="0010") then states<="0010" elsif (st<="0100") then states<=

11、"0011"elsif (st<="1000") then states<="0100" end if; end process p2;end one;2、仿真圖:(二)計(jì)時(shí)模塊 1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity js is port(clk,rst,s,stop:in std_logic; warn:out std_logic; ta,tb:buffer std_logic_ve

12、ctor(3 downto 0);end js;architecture one of js issignal co:std_logic;beginp1:process(clk,rst,s,stop,ta) begin if rst='0' or stop='1' then ta<="0000" elsif clk'event and clk='1' then co<='0' if s='1' then if ta="0000" then ta<=&

13、quot;1001"co<='1' else ta<=ta-1; end if; end if; end if;end process p1;p2:process(co,rst,s,stop,tb) begin if rst='0' or stop='1' then tb<="0010" elsif co'event and co='1' then if s='1' then if tb="0000" then tb<="0

14、011" else tb<=tb-1; end if; end if; end if;end process p2;2、仿真圖(三)數(shù)據(jù)選擇模塊1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity sjxz is port (a,b,c: in std_logic_vector(3 downto 0);clk2,rst: in std_logic; s: out std_logic_vector(1

15、 downto 0); y: out std_logic_vector(3 downto 0) ); end sjxz;architecture body_chooser of sjxz is signal count: std_logic_vector (1 downto 0); begin s<=count; process(clk2,rst) begin if(rst='0')then count<="00" elsif(clk2'event and clk2='1')then if(count>="

16、10")then count<="00" else count<=count+1; end if;end if;case count is when "00"=>y<=a; when "01"=>y<=b; when "10"=>y<=c; when others=>null; end case; end process; end body_chooser;2、仿真圖(四)報(bào)警模塊1、vhdl源程序library ieee;use ieee.std_l

17、ogic_1164.all;use ieee.std_logic_unsigned.all;entity alarm isport(clk,i:in std_logic; q:out std_logic);end alarm;architecture behave of alarm is signal warn:std_logic; signal n:integer range 0 to 20;begin q<= warn; process(clk) begin if clk'event and clk='1' then if i='0' then

18、 warn <='0' elsif(i='1'and n<=19)then warn <=not warn; n<=n+1; else warn <='0' end if; end if;end process;end behave;2、仿真圖(五)譯碼模塊1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ymq is port(ain4: in std_logic_vector(3 dow

19、nto 0); dout7: out std_logic_vector(6 downto 0);end ymq;architecture art of ymq isbegin process(ain4) begin case ain4 is when "0000"=>dout7<="1111110" -0 when "0001"=>dout7<="0110000" -1 when "0010"=>dout7<="1101101" -2 wh

20、en "0011"=>dout7<="1111001" -3 when "0100"=>dout7<="0110011" -4 when "0101"=>dout7<="1011011" -5 when "0110"=>dout7<="1011111" -6 when "0111"=>dout7<="1110000" -7 when &q

21、uot;1000"=>dout7<="1111111" -8 when "1001"=>dout7<="1111011" -9 when others=>dout7<="0000000" end case; end process;end architecture art;2、仿真圖(六)分頻模塊1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.

22、std_logic_unsigned.all;entity clkdiv isport(clk2 : in std_logic;clk16 : out std_logic);end clkdiv;architecture rtl of clkdiv issignal count : std_logic_vector(3 downto 0);beginprocess(clk2)beginif (clk2'event and clk2='1') thenif(count="1111") thencount <="0000"els

23、ecount <= count +1;end if ;end if ;end process;process(clk2)beginif (clk2'event and clk2='1') thenif(count="1111") thenclk16 <= '1'elseclk16 <= '0'end if ;end if ;end process;end rtl;2、仿真圖(七)頂層文件1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee

24、.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity qiangdaqi is port(clk,clk2,s,s0,s1,s2,s3,stop,rst:in std_logic; n,k,q_out:out std_logic; m:out std_logic_vector(1 downto 0); a,b,c,d,e,f,g:out std_logic);end qiangdaqi;architecture bhv of qiangdaqi iscomponent qdjb is port(clk2,rst:in std_l

25、ogic; s0,s1,s2,s3:in std_logic; tmp:out std_logic; states:out std_logic_vector(3 downto 0);end component;component js is port(clk,rst,s,stop:in std_logic; ring,warn:out std_logic; ta,tb:buffer std_logic_vector(3 downto 0);end component;component sjxz is port(clk2,rst:in std_logic; s:out std_logic_ve

26、ctor(1 downto 0); a,b,c:in std_logic_vector(3 downto 0); y:out std_logic_vector(3 downto 0);end component;component ymq is port(ain4: in std_logic_vector (3 downto 0); dout7: out std_logic_vector (6 downto 0);end component;component alarm is port(clk,i:in std_logic; q:out std_logic);end component;si

27、gnal states_out,ta_out,tb_out,y_out:std_logic_vector(3 downto 0);signal ledout:std_logic_vector(6 downto 0);signal w:std_logic;begina<=ledout(6);b<=ledout(5);c<=ledout(4);d<=ledout(3);e<=ledout(2);f<=ledout(1);g<=ledout(0);u1:qdjb port map(clk2,rst,s0,s1,s2,s3,tmp=>k,states=&

28、gt;states_out);u2:js port map(clk,rst,s,stop,warn=>n,ta=>ta_out,tb=>tb_out);u3:sjxzportmap(clk2=>clk2,rst=>rst,a=>states_out,b=>ta_out,c=>tb_out,s=>m,y_out;u4:ymq port map(ain4=>y_out,dout7=>ledout);u5:alarm port map(clk2,i=>s,q_out);end bhv;2、仿真圖(八)主電路連線圖(九)將程序下載到芯片flexepf10lc84-4上,引腳圖如下四、器件編程與下載將編譯好的模塊程序下載到cpld中(注:device選取要與硬件對應(yīng),否則會導(dǎo)致實(shí)驗(yàn)失敗),連線做硬件實(shí)驗(yàn)。五、性能測試與分析按下rst鍵清零,按下s鍵,觀察數(shù)碼管是否開始倒計(jì)時(shí),揚(yáng)聲器是否發(fā)出報(bào)警聲,按下s0,觀察數(shù)碼管是否顯示1和搶答的時(shí)間,再按s1,s2.s3均不改變顯示,按下rst鍵,觀察是否清零,再按s鍵,不按別的,直到計(jì)時(shí)時(shí)間到,觀察是否顯示00,揚(yáng)聲器是否發(fā)出報(bào)警。 六、實(shí)驗(yàn)設(shè)備計(jì)算機(jī),el教學(xué)實(shí)驗(yàn)箱七、心

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論