EDA课程设计-GSM通讯机的VHDL设计及仿真.doc_第1页
EDA课程设计-GSM通讯机的VHDL设计及仿真.doc_第2页
EDA课程设计-GSM通讯机的VHDL设计及仿真.doc_第3页
EDA课程设计-GSM通讯机的VHDL设计及仿真.doc_第4页
EDA课程设计-GSM通讯机的VHDL设计及仿真.doc_第5页
免费预览已结束,剩余14页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

课程设计说明书 no.1gsm通讯机的vhdl设计及仿真1.课程设计的目的 eda技术及应用课程设计是学习eda技术及应用课程之后的实践教学环节。其目的是训练学生综合运用学过的eda技术及应用的基础知识,通过解决比较简单的实际问题巩固和加深在eda技术及应用课程中所学的理论知识和实验技能。独立完成查找资料,选择方案,设计电路,安装调试,分析结果,撰写报告等工作。使学生进一步理解所学本课程的内容,初步掌握模拟电子电路设计的一般方法步骤,通过理论联系实际提高和培养学生。并理论联系实际提高和培养学生的分析、解决实际问题的能力,创新能力及动手能力,为后续课程的学习、毕业设计、毕业后的工作打下基础。2.设计方案论证2.1软件介绍 max+plus是altera公司提供的fpga/cpld开发集成环境,altera是世界上最大可编程逻辑器件的供应商之一。max+plus界面友好,使用便捷,被誉为业界最易用易学的eda软件。在max+plus上可以完成设计输入、元件适配、时序仿真和功能仿真、编程下载整个流程,它提供了一种与结构无关的设计环境,是设计者能方便地进行设计输入、快速处理和器件编程。max+plus开发系统的特点:(1)、开放的界面,max+plus支持与cadence,exemplarlogic,mentor graphics,synplicty,viewlogic和其它公司所提供的eda工具接口。(2)、与结构无关,max+plus系统的核心complier支持altera公司的flex10k、flex8000、flex6000、max9000、max7000、max5000和classic可编程逻辑器件,提供了世界上唯一真正与结构无关的可编程逻辑设计环境。(3)、完全集成化,max+plus的设计输入、处理与较验功能全部集成在统一的开发环境下,这样可以加快动态调试、缩短开发周期。(4)、丰富的设计库,max+plus提供丰富的库单元供设计者调用,其中包括74系列的全部器件和多种特殊的逻辑功能(macro-function)以及新型的参数化的兆功能(mage-function) 沈 阳 大 学 课程设计说明书 no.2(5)、模块化工具,设计人员可以从各种设计输入、处理和较验选项中进行选择从而使设计环境用户化。(6)、硬件描述语言(hdl),max+plus软件支持各种hdl设计输入选项,包括vhdl、verilog hdl和altera自己的硬件描述语言ahdl。(7)、opencore特征,max+plus软件具有开放核的特点,允许设计人员添加自己认为有价值的宏函数。2.2设计方案2.2.1实现功能 (1)显示系统当前运行状态,由vga接口输出,在液晶屏上以640*480分辨率显示; (2)实时检测输入设备,对gsm模块进行操控,输入设备采用ps/2接口键盘; (3)通过rs232接口连接gsm模块,采用uart标准进行全双工通信,发送at命令控制gsm模块,gsm模块返回信息通过uart由系统接收并做出相应处理; (4)支持gsm拨号功能; (5)支持短信收发功能,并可实时查阅、删除已有短信; (6)编辑模式可通过backspace键删除误输入; (7)支持来电号码显示,并周期性发出来电铃声; (8)支持新短信显示提示,并发出一声短信提示音; (9)支持中文菜单显示,通过上下箭头按键选择不同菜单项; (10)界面支持字体变色、动态滚动效果。2.2.2系统框图 沈 阳 大 学 课程设计说明书 no.3 fpga主控制器液晶显示器ps/2接口键盘gsm模块vgaps/2uart图1 gsm系统框图由上图可见,主控制器通过3个接口分别连接了3个硬件,对应不同接口应该独立地进行处理,所以必须对主控制器进行模块划分。3.设计结果与分析模块1:分频 功能描述:将50mhz时钟源进行分频,提供给vga模块(25mhz)和uart模块,其中uart模块为波特率可调,通过改变cnt_rs232的值实现不同的波特率。 具体代码:library ieee;use ieee.std_logic_1164.all;entity frequency is generic (cnt_rs232:integer:=163; cnt_vga: integer:=1);port( clk:in std_logic; clk_rs232:out std_logic; clk_vga:out std_logic);end entity;architecture frequency_div of frequency isbegin 沈 阳 大 学 课程设计说明书 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: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;end process;end architecture; 将以上程序写入max+pluwe2中进行编译仿真,可得如下结果。图2 frequency元件图 沈 阳 大 学 课程设计说明书 no.5图3 对 frequency程序的仿真结果图 模块2:ps/2 keyboard 功能描述:接收键盘的时钟源ps2_clk,并进行平滑处理,接收完一个按键相应输出按键的通码makecode和触发信号trig,另外输出平滑后的键盘时钟信号ps2_clksm,为接收模块提供同步时钟。 具体代码:library ieee;use ieee.std_logic_1164.all;entity ps2keyboard 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:std_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; 沈 阳 大 学 课程设计说明书 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_clk=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 cnt=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;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 and 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); 沈 阳 大 学 课程设计说明书 no.10count:=count+1;if count=8 then count:=0;cnt:=0;rp_state:=r2;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; 将以上程序写入max+pluwe2中进行编译仿真,可得如下结果。图6 uart_withoutparity元件图 沈 阳 大 学 课程设计说明书 no.11图7对uart_withoutparity程序仿真图 模块4vga接口 vga模块由3个子模块组成,分别是content、vga、vga_div,其中vga_div模块将显示器分割成20*15个小块,vga模块输出信号至显示器,content模块包含了所要显示的内容,还包括了键盘按键的判断、uart的缓存数据,还是整个系统主要的状态控制器。将这3个模块用component语句进行例化,生成vga_interface模块,再在顶层的block diagram文件进行调用,减少了顶层文件连线的复杂性。 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 downto 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 沈 阳 大 学 课程设计说明书 no.12p1:process (clk_vga)beginif rising_edge(clk_vga) then if h_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;else null;end if;else null;end if;end process p3; 沈 阳 大 学 课程设计说明书 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 :=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+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=14) then div_yx00000100028002800440044008200fe0101010102008701c0000000000000000,66=x00001fe008100810081008200fc008200810081008101fe00000000000000000,67=x000007c008201010100010001000100010001010082007c00000000000000000,beginprocess (clk)variable color:std_logic_vector (2 downto 0):=000; variable cnt:integer range 0 to 10000000 :=0; 沈 阳 大 学 课程设计说明书 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=color; 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的源程序进行编译仿真得到其原理图。图8vga原理图 沈 阳 大 学 课程设计说明书 no.16图9 对vga源程序的仿真结果图图10 得到的vga_div、content原理图模块5:整个系统图11整个gsm通讯机原理图 沈 阳 大 学 课程设计说明书 no.17如图,为使系统各模块关系更加清楚,我们将各个模块创建为符号文件,并在bdf文件中指定连接关系。4. 设计体会通过这次eda技术及应用课程设计,加强了我们动手能力,提高了我们的思考和解决问题的思维。此次设计我们选用的是max+plusii软件,在整个设计过程中整个小组的同学团结一致和互帮互助,遇到了很多问题,有时心里想着这样的接法可以行得通,但实际进行运行仿真时,总是实现不了,但最终通过我们自己的努力解决了这些问题,我们受益匪浅。做课程设计同时也是对课本知识的巩固和加强,由于课本上的知识太多,平时课间的学习并

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论