EDA課程設(shè)計(jì)GSM通訊機(jī)的VHDL設(shè)計(jì)及仿真_第1頁
EDA課程設(shè)計(jì)GSM通訊機(jī)的VHDL設(shè)計(jì)及仿真_第2頁
EDA課程設(shè)計(jì)GSM通訊機(jī)的VHDL設(shè)計(jì)及仿真_第3頁
EDA課程設(shè)計(jì)GSM通訊機(jī)的VHDL設(shè)計(jì)及仿真_第4頁
EDA課程設(shè)計(jì)GSM通訊機(jī)的VHDL設(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、 課程設(shè)計(jì)說明書 no.1gsm通訊機(jī)的vhdl設(shè)計(jì)及仿真1.課程設(shè)計(jì)的目的 eda技術(shù)及應(yīng)用課程設(shè)計(jì)是學(xué)習(xí)eda技術(shù)及應(yīng)用課程之后的實(shí)踐教學(xué)環(huán)節(jié)。其目的是訓(xùn)練學(xué)生綜合運(yùn)用學(xué)過的eda技術(shù)及應(yīng)用的基礎(chǔ)知識,通過解決比較簡單的實(shí)際問題鞏固和加深在eda技術(shù)及應(yīng)用課程中所學(xué)的理論知識和實(shí)驗(yàn)技能。獨(dú)立完成查找資料,選擇方案,設(shè)計(jì)電路,安裝調(diào)試,分析結(jié)果,撰寫報(bào)告等工作。使學(xué)生進(jìn)一步理解所學(xué)本課程的內(nèi)容,初步掌握模擬電子電路設(shè)計(jì)的一般方法步驟,通過理論聯(lián)系實(shí)際提高和培養(yǎng)學(xué)生。并理論聯(lián)系實(shí)際提高和培養(yǎng)學(xué)生的分析、解決實(shí)際問題的能力,創(chuàng)新能力及動(dòng)手能力,為后續(xù)課程的學(xué)習(xí)、畢業(yè)設(shè)計(jì)、畢業(yè)后的工作打下基礎(chǔ)。2

2、.設(shè)計(jì)方案論證2.1軟件介紹 max+plus是altera公司提供的fpga/cpld開發(fā)集成環(huán)境,altera是世界上最大可編程邏輯器件的供應(yīng)商之一。max+plus界面友好,使用便捷,被譽(yù)為業(yè)界最易用易學(xué)的eda軟件。在max+plus上可以完成設(shè)計(jì)輸入、元件適配、時(shí)序仿真和功能仿真、編程下載整個(gè)流程,它提供了一種與結(jié)構(gòu)無關(guān)的設(shè)計(jì)環(huán)境,是設(shè)計(jì)者能方便地進(jìn)行設(shè)計(jì)輸入、快速處理和器件編程。max+plus開發(fā)系統(tǒng)的特點(diǎn):(1)、開放的界面,max+plus支持與cadence,exemplarlogic,mentor graphics,synplicty,viewlogic和其它公司所提供的

3、eda工具接口。(2)、與結(jié)構(gòu)無關(guān),max+plus系統(tǒng)的核心complier支持altera公司的flex10k、flex8000、flex6000、max9000、max7000、max5000和classic可編程邏輯器件,提供了世界上唯一真正與結(jié)構(gòu)無關(guān)的可編程邏輯設(shè)計(jì)環(huán)境。(3)、完全集成化,max+plus的設(shè)計(jì)輸入、處理與較驗(yàn)功能全部集成在統(tǒng)一的開發(fā)環(huán)境下,這樣可以加快動(dòng)態(tài)調(diào)試、縮短開發(fā)周期。(4)、豐富的設(shè)計(jì)庫,max+plus提供豐富的庫單元供設(shè)計(jì)者調(diào)用,其中包括74系列的全部器件和多種特殊的邏輯功能(macro-function)以及新型的參數(shù)化的兆功能(mage-funct

4、ion) 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.2(5)、模塊化工具,設(shè)計(jì)人員可以從各種設(shè)計(jì)輸入、處理和較驗(yàn)選項(xiàng)中進(jìn)行選擇從而使設(shè)計(jì)環(huán)境用戶化。(6)、硬件描述語言(hdl),max+plus軟件支持各種hdl設(shè)計(jì)輸入選項(xiàng),包括vhdl、verilog hdl和altera自己的硬件描述語言ahdl。(7)、opencore特征,max+plus軟件具有開放核的特點(diǎn),允許設(shè)計(jì)人員添加自己認(rèn)為有價(jià)值的宏函數(shù)。2.2設(shè)計(jì)方案2.2.1實(shí)現(xiàn)功能 (1)顯示系統(tǒng)當(dāng)前運(yùn)行狀態(tài),由vga接口輸出,在液晶屏上以640*480分辨率顯示; (2)實(shí)時(shí)檢測輸入設(shè)備,對gsm模塊進(jìn)行操控,輸入設(shè)備采用ps/2接口

5、鍵盤; (3)通過rs232接口連接gsm模塊,采用uart標(biāo)準(zhǔn)進(jìn)行全雙工通信,發(fā)送at命令控制gsm模塊,gsm模塊返回信息通過uart由系統(tǒng)接收并做出相應(yīng)處理; (4)支持gsm撥號功能; (5)支持短信收發(fā)功能,并可實(shí)時(shí)查閱、刪除已有短信; (6)編輯模式可通過backspace鍵刪除誤輸入; (7)支持來電號碼顯示,并周期性發(fā)出來電鈴聲; (8)支持新短信顯示提示,并發(fā)出一聲短信提示音; (9)支持中文菜單顯示,通過上下箭頭按鍵選擇不同菜單項(xiàng); (10)界面支持字體變色、動(dòng)態(tài)滾動(dòng)效果。2.2.2系統(tǒng)框圖 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.3 fpga主控制器液晶顯示器ps/2接口鍵

6、盤gsm模塊vgaps/2uart圖1 gsm系統(tǒng)框圖由上圖可見,主控制器通過3個(gè)接口分別連接了3個(gè)硬件,對應(yīng)不同接口應(yīng)該獨(dú)立地進(jìn)行處理,所以必須對主控制器進(jìn)行模塊劃分。3.設(shè)計(jì)結(jié)果與分析模塊1:分頻 功能描述:將50mhz時(shí)鐘源進(jìn)行分頻,提供給vga模塊(25mhz)和uart模塊,其中uart模塊為波特率可調(diào),通過改變cnt_rs232的值實(shí)現(xiàn)不同的波特率。 具體代碼:library ieee;use ieee.std_logic_1164.all;entity frequency is generic (cnt_rs232:integer:=163; cnt_vga: integer:=

7、1);port( clk:in std_logic; clk_rs232:out std_logic; clk_vga:out std_logic);end entity;architecture frequency_div of frequency isbegin 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.4 process (clk)variable reg_rs232:std_logic :=0; variable reg_vga:std_logic :=0;variable temp_rs232:integer range 0 to cnt_rs232; variable temp_vga

8、:integer range 0 to cnt_vga;beginif (clkevent and clk=1) thentemp_rs232:=temp_rs232+1; temp_vga:=temp_vga+1;if (temp_rs232=cnt_rs232) then reg_rs232:=not reg_rs232; temp_rs232:=0;clk_rs232=reg_rs232;end if; if (temp_vga=cnt_vga) thenreg_vga:=not reg_vga; temp_vga:=0;clk_vga=reg_vga;end if; end if;en

9、d process;end architecture; 將以上程序?qū)懭雖ax+pluwe2中進(jìn)行編譯仿真,可得如下結(jié)果。圖2 frequency元件圖 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.5圖3 對 frequency程序的仿真結(jié)果圖 模塊2:ps/2 keyboard 功能描述:接收鍵盤的時(shí)鐘源ps2_clk,并進(jìn)行平滑處理,接收完一個(gè)按鍵相應(yīng)輸出按鍵的通碼makecode和觸發(fā)信號trig,另外輸出平滑后的鍵盤時(shí)鐘信號ps2_clksm,為接收模塊提供同步時(shí)鐘。 具體代碼:library ieee;use ieee.std_logic_1164.all;entity ps2keyboar

10、d is port(clk,ps2_clk,ps2_data:in std_logic; trig:out std_logic; make_code:out std_logic_vector(7 downto 0); ps2_clksm: out std_logic);end entity;architecture code of ps2keyboard istype state_type is(s1,s2);type cache_type is array(2 downto 0) of std_logic_vector(7 downto 0);signal smooth_ps2_clk:st

11、d_logic;beginsmooth:process(clk)variable cnt:integer range 0 to 7;variable scan:std_logic_vector(7 downto 0);beginif falling_edge(clk) thenscan(cnt):=ps2_clk; 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.6if cnt=7 then cnt:=0;else cnt:=cnt+1;end if;if scan=11111111 then smooth_ps2_clk=1;elsif scan=00000000 then smooth_ps2_cl

12、k=0;end if;end if;end process smooth;receive:process(smooth_ps2_clk)variable cnt:integer range 0 to 10;variable count:integer range 0 to 2;variable pstate:state_type;variable cache:cache_type;variable reg:std_logic_vector(10 downto 0);beginif falling_edge(smooth_ps2_clk) thenreg(cnt):=ps2_data;if cn

13、t=10 then cnt:=0;if count=1 and reg(8 downto 1)/=xf0 then count:=0;end if;cache(count):=reg(8 downto 1 ); if count=0 thencount:=count+1;make_code=cache(0);trig=1;elsif count=2 then count:=0;make_code=cache(0);trig=0;else count:=count+1;trig=0;make_code=cache(0);end if;else cnt:=cnt+1; end if;end if;

14、end process receive;ps2_clksm txd temp:=data_in;txd txdtxdsp_state:=s1;end case;end if;end process send;receive:process(clk_uart) variable rp_state:rece_state; variable reg:std_logic_vector(7 downto 0); variable cnt:integer range 0 to 16; variable count:integer range 0 to 8; begin if clk_uartevent a

15、nd clk_uart=1 then case rp_state iswhen r0=rece_mark0);if rxd=0 thencnt:=cnt+1;if cnt=8 then rp_state:=r1;end if;else cnt:=0;end if;when r1=cnt:=cnt+1;if cnt=16 then cnt:=0;end if;if cnt=8 thenreg:=rxd®(7 downto 1); 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.10count:=count+1;if count=8 then count:=0;cnt:=0;rp_state:=r2;

16、end if;end if;when r2=data_out=reg(7 downto 0);rece_markrp_state:=r0;end case; end if;end process receive;end architecture; 將以上程序?qū)懭雖ax+pluwe2中進(jìn)行編譯仿真,可得如下結(jié)果。圖6 uart_withoutparity元件圖 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.11圖7對uart_withoutparity程序仿真圖 模塊4vga接口 vga模塊由3個(gè)子模塊組成,分別是content、vga、vga_div,其中vga_div模塊將顯示器分割成20*15個(gè)小

17、塊,vga模塊輸出信號至顯示器,content模塊包含了所要顯示的內(nèi)容,還包括了鍵盤按鍵的判斷、uart的緩存數(shù)據(jù),還是整個(gè)系統(tǒng)主要的狀態(tài)控制器。將這3個(gè)模塊用component語句進(jìn)行例化,生成vga_interface模塊,再在頂層的block diagram文件進(jìn)行調(diào)用,減少了頂層文件連線的復(fù)雜性。 vga的vhdl源代碼如下:library ieee;use ieee.std_logic_1164.all;entity vga isport(clk_vga:in std_logic;hs,vs:out std_logic;rgb:out std_logic_vector (2 down

18、to 0);rgb_data:in std_logic_vector (2 downto 0);rgb_h:inout std_logic;rgb_v:inout std_logic);end entity;architecture vga_dis of vga issignal h_cnt:integer range 0 to 800 :=0;signal v_cnt:integer range 0 to 525 :=0;begin 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.12p1:process (clk_vga)beginif rising_edge(clk_vga) then if h_

19、cnt=799 then h_cnt=0;if v_cnt=524 then v_cnt=0;else v_cnt36 and v_cnt=516) then rgb_v=not rgb_v;else null;end if; end if;else h_cnt151 and h_cnt=791) then rgb_h=8 and h_cnt=103) then hs=0;else hs=2 and v_cnt=3) then vs=0;else vs=37 and v_cnt=152 and h_cnt=791) then rgb=rgb_data;else rgb=000;end if;e

20、lse null;end if;else null;end if;end process p3; 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.13end;vga_div的vhdl源代碼如下:library ieee;use ieee.std_logic_1164.all;entity vga_div isport(clk:in std_logic;rgb_h,rgb_v:in std_logic;x:inout integer range 0 to 16 :=0;y:inout integer range 0 to 16 :=0;div_x:inout integer range 0 to 19 :

21、=0;div_y:inout integer range 0 to 14 :=0);end entity;architecture vga_con of vga_div issignal v_cnt:integer range 0 to 240 :=0;signal h_cnt:integer range 0 to 320 :=0;begin cnt1:process(rgb_h) beginif rising_edge (rgb_h) then h_cnt=h_cnt+1;x=x+1; if h_cnt=319 then h_cnt=0;else null;end if;if (h_cnt+

22、1) mod 16)=0) then div_x=div_x+1; x=0; if (div_x=19) then div_x=0; else null;end if; else null;end if;end if;end process cnt1;cnt2:process(rgb_v)begin if rising_edge (rgb_v) thenv_cnt=v_cnt+1;y=y+1;if v_cnt=239 then v_cnt=0;else null;end if;if (v_cnt+1) mod 16)=0) then div_y=div_y+1; y=0;if (div_y=1

23、4) then div_yx00000100028002800440044008200fe0101010102008701c0000000000000000,66=x00001fe008100810081008200fc008200810081008101fe00000000000000000,67=x000007c008201010100010001000100010001010082007c00000000000000000,beginprocess (clk)variable color:std_logic_vector (2 downto 0):=000; variable cnt:i

24、nteger range 0 to 10000000 :=0; 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.15beginif rising_edge(clk) thenif cnt=10000000 then cnt:=0;if color=111 then color:=001;else color:=color+1;end if;else cnt:=cnt+1;end if;if pix_all(data(div_y)(div_x)(y*16+x)=0 then rgb_data=000;elseif invert_data(div_y)(div_x)=1 then rgb_data=colo

25、r; else rgb_data=0&pix_all(data(div_y)(div_x)(y*16+x)&1; end if;end if;end if;end process;end architecture;分別對 vga、vga_div、content的源程序進(jìn)行編譯仿真得到其原理圖。圖8vga原理圖 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.16圖9 對vga源程序的仿真結(jié)果圖圖10 得到的vga_div、content原理圖模塊5:整個(gè)系統(tǒng)圖11整個(gè)gsm通訊機(jī)原理圖 沈 陽 大 學(xué) 課程設(shè)計(jì)說明書 no.17如圖,為使系統(tǒng)各模塊關(guān)系更加清楚,我們將各個(gè)模塊創(chuàng)建為符號文件,并在bdf文件中指定連接關(guān)系。4. 設(shè)計(jì)體會(huì)通過這次eda技術(shù)及應(yīng)用課程設(shè)計(jì),加強(qiáng)了我們動(dòng)手能力,提高了我們的思考和解決問題的思維。此次設(shè)計(jì)我們選用的是max+plusii軟件,在整個(gè)設(shè)計(jì)過程中整個(gè)小組的同學(xué)團(tuán)結(jié)一致和互幫互助,遇到了很多問題,有時(shí)心里想著這樣的接法可以行得通,但實(shí)際進(jìn)行運(yùn)行仿真時(shí),總是實(shí)現(xiàn)不了,但最終通過我們自己的努力解決了這些問題,我們受益匪淺。做課程設(shè)計(jì)同時(shí)也是對課本知識的鞏固和加強(qiáng),由于課本上的知識太多,平時(shí)課間的學(xué)習(xí)并

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(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

提交評論