ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:3.66MB ,
资源ID:5026176      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5026176.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(EDA课程设计乒乓球游戏机.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

EDA课程设计乒乓球游戏机.docx

1、EDA课程设计乒乓球游戏机基于FPGA的数字系统设计项目设计文档项目名称: 乒乓球比赛游戏机 姓 名: 院 系: 应用技术学院 专 业: 电子信息工程 学 号: 指导教师: 陈 强 完成时间: 2012年 06月19日基于FPGA的数字系统设计项目成绩评价表设计题目乒乓球比赛游戏机设计要求设计一个乒乓球比赛游戏机,能模拟比赛的基本过程和规则并能自动裁判和记分,具体要求如下: (1)使用乒乓球游戏机的双方在不同位置发球或击球; (2)乒乓球的位置和移动方向由灯亮和依次亮的方向决定。使用者根据球的位置发出相应的动作;(3)比赛用11分为一局来进行,双方设置各自的记分牌,任意一方先记满11分就获胜此

2、局。当记分牌清零后,开始新的一局比赛;(4)比赛结束后音乐自动响起。设计过程用8个LED排成一条直线,以中点为界,两边各代表参赛双方的位置,其中一只点亮的LED指示球的当前位置,点亮的LED依次从左到右,或从右到左,其移动的速度应能调节。“球”(点亮的那只LED)运动到某方的最后一位时,参赛者应能果断地按下位于自己一方的按纽开关,即表示启动球拍击球,若击中,则球向相反方向运动;若未中,球掉出桌外,则对方得一分。设置自动记分电路,甲乙双方各用两位数码管进行记分显示,每计满11分为1局。甲乙双方各设一个发光二极管表示拥有发球权,每隔2次自动交换发球权,拥有发球权的一方发球才有效。项目设计成绩评价评

3、价项目指 标满分评分工作量、工作态度和出勤率按期圆满的完成了规定的任务,难易程度和工作量符合教学要求,工作努力,遵守纪律,出勤率高,工作作风严谨,善于与他人合作。30课程设计质量项目设计系统架构合理,设计过程简练正确,分析问题思路清晰,结构严谨,文理通顺,撰写规范,图表完备正确。40创新工作中有创新意识,对前人工作有一些改进或有一定应用价值。15答辩能正确回答指导教师所提出的问题。15综合成绩等级指导教师: 年 月 日目 录1 项目名称、内容与要求 04页1.1 设计内容04页1.2 具体要求04页2 系统整体架构(Architecture Description) 04页2.1 设计思路04

4、页2.2 系统原理(包含:框图等阐述与设计说明等内容)04页3 系统设计 (含HDL或原理图输入设计)05页3.1 HDL 代码05页3.2 系统整体电路图(或RTL级电路图)12页4 系统仿真(Simulation Waveform)13页5 FPGA实现(FPGA Implementation) 14页6 总结(Closing)16页参考书目(Reference):16页一、项目名称、内容与要求1.1项目名称乒乓球比赛游戏机1.2设计内容设计一个由甲乙双方参赛,二人乒乓球游戏机。用8个(或更多个)LED排成一条直线,以中点为界,两边各代表参赛双方的位置,其中一只点亮的LED指示球的当前位置

5、,点亮的LED依次从左到右,或从右到左,其移动的速度应能调节。当“球”(点亮的那只LED)运动到某方的最后一位时,参赛者应能果断地按下位于自己一方的按纽开关,即表示启动球拍击球,若击中,则球向相反方向运动;若未中,球掉出桌外,则对方得一分。设置自动记分电路,甲乙双方各用两位数码管进行记分显示,每计满11分为1局。甲乙双方各设一个发光二极管表示拥有发球权,每隔2次自动交换发球权,拥有发球权的一方发球才有效。1.3具体要求(1)使用乒乓球游戏机的双方在不同位置发球或击球。(2)乒乓球的位置和移动方向由灯亮和依次亮的方向决定。使用者根据球的位置发出相应的动作。(3)比赛用11分为一局来进行,双方设置

6、各自的记分牌,任意一方先记满21分就获胜此局。当记分牌清零后,开始新的一局比赛。(4)比赛结束后音乐自动响起。二、系统整体架构(Architecture Description)2.1设计思路 根据系统设计的要求,乒乓球比赛游戏机的电路原理框图如下:三、系统设计 (含HDL或原理图输入设计)3.1 VHDL 代码比赛模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all; -引用必要的库函数和包集合entity compete is -实体名为

7、pingpong port(reset:in std_logic; clk_1:in std_logic; startbutton:in std_logic; -开始游戏输入端口 serve:in std_logic_vector(1 downto 0); -发球输入端口 hit1,hit2:in std_logic; -甲和乙的击球输入端口 light:out std_logic_vector(1 to 8); -控制8个发光二极管的输出端口 music_begin:out std_logic;-控制音乐开始的输出端口 counta,countb:out std_logic_vector(3

8、 downto 0); -2个用于控制4个7段译码器的输出端口end compete;architecture one of compete istype pingpong is (waitserve,light1on,ballmoveto2,allow2hit,light8on,ballmoveto1,allow1hit);-设置7个状态,为枚举数据类型,记为pingpong signal state:pingpong;signal i:integer range 0 to 8;signal count1,count2,count3,count4:std_logic_vector(3 dow

9、nto 0):=0000; -内部计数器,是4位二进制变量begin process(clk_1) begin if(clk_1event and clk_1=1) then if count3=0001 or count4=0001 then music_begin=1; end if; if(reset=1)then music_begin=0; end if; end if; end process; process(clk_1) -状态机进程 -clk_1作为敏感信号触发进程 begin -进程开始 if reset=1 then -异步置位 i=0;count1=0000;count

10、2=0000;count3=0000;count4=0000; elsif clk_1event and clk_1=1 then -当处于时钟inclock上升沿时 if count1=1011 then i=0;count1=0000;count2=0000;count3=count3+1; elsif count2=1011 then i=0;count1=0000;count2=0000;count4=count4+1; elsif startbutton=0 then i=0;count1=0000;count2=0000;count3=0000;count4 -进程处于等待发球状态

11、 case serve is when 01= i=1;state i=8;statei i -进程处于第一盏灯亮状态 i=2; if hit2=1 then i=0; count1=count1+1;state=waitserve; else state -进程处于第八盏灯亮状态 i=7; if hit1=1 then i=0; count2=count2+1;state=waitserve; else state -进程处于球向乙移动状态 if hit1=1 then i=0; count2=count2+1;state=waitserve; elsif i=2 then i=1; sta

12、te=allow1hit; else i -进程处于球向乙移动状态 if hit2=1then i=0; count1=count1+1;state=waitserve; elsif i=7 then i=8; state=allow2hit; else i -进程处于允许甲击球状态 if hit1=1 then i=2; state=ballmoveto2; else count2=count2+1;i=0; state -进程处于允许乙击球状态 if hit2=1then i=7;state=ballmoveto1; else count1=count1+1;i=0; state=wait

13、serve; end if; end case; end if; end if;end process;counta=count1;countb=count2; -进程处i信号控制发光二极管的亮暗light=10000000when(i=1) else01000000 when(i=2) else00100000 when(i=3) else00010000 when(i=4) else00001000 when(i=5) else00000100 when(i=6) else00000010 when(i=7) else00000001 when(i=8) else00000000; -其他

14、情况所有发光二极管都暗end one;分频模块library IEEE; use IEEE.std_logic_1164.all;use ieee.std_logic_arith.all;use IEEE.std_logic_unsigned.all;entity division16 isport( cp:in std_logic; clk_4:out std_logic );end division16;architecture division_body of division16 issignal count:std_logic_vector(3 downto 0);beginproc

15、ess(cp)beginif(cpevent and cp=1)then if(count=1111)thencount0);elsecount=count+1;end if;end if;end process;process(cp)beginif(cpevent and cp=1)then if(count=1111)thenclk_4=1;elseclk_4qqqqqqqqqqq=0000000; end case; end process; end disp_arc;数码管选择LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY mux2 IS

16、 PORT(a,b: IN STD_LOGIC_VECTOR(6 downto 0);sel: IN STD_LOGIC;c:OUT STD_LOGIC_VECTOR(6 downto 0);END mux2;ARCHITECTURE example OF mux2 IS BEGIN PROCESS(sel) BEGINIF(SEL=1)THEN c=a;ELSE c=b;END IF;END PROCESS;END example;音乐模块(两只老虎)library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.

17、all;entity music is port ( music_begin:in std_logic; clk_4:in std_logic; clk:in std_logic; music_out:out std_logic ); end music;architecture music_body of music is constant m1:integer:=637;-955; constant m2:integer:=587;-851; constant m3:integer:=505;-758; constant m4:integer:=468;-716; constant m5:

18、integer:=425;-639; constant m6:integer:=379;-569; constant m7:integer:=330;-506; constant m0:integer:=0; signal counter:integer range 0 to 67; signal count:integer range 0 to 1000; signal sub:integer range 0 to 1000; signal carrier:std_logic; signal pat,pat1,pat2:std_logic;begin process(clk) begin i

19、f(clkevent and clk=1)then if(carrier=1) then sub=count; else sub=sub-1; end if; end if; end process; process(sub) begin if(sub=0) then pat=1; else pat=0; end if; carrier=pat; end process; process(clk) begin if(clkevent and clk=1)then pat1=pat; end if; end process; process(pat1) begin if(pat1event an

20、d pat1=1) then pat2= not pat2; end if; music_out=pat2; end process; process(clk_4) begin if(clk_4event and clk_4=1) then if(music_begin=1) then counter=counter+1; else countercountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcount

21、countcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcountcount=m0; end case; end process; end music_body;3.2 系统整体电路图(或RTL级电路图)四、系统仿真(Simulation Waveform)功能仿真波形图时序仿真波形图 五、 FPGA实现(FPGA Implementation)将程序下载到EDA2000实验箱然后按照设定的管脚在EDA

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1