文档详情

eda课程设计基于vhd语言的乒乓球游戏机设计 毕业论文 .doc

发布:2017-04-03约9.98千字共14页下载文档
文本预览下载声明
目 录 1 项目名称、内容与要求 ………………………………………04页 1.1 设计内容…………………………………………………04页 1.2 具体要求…………………………………………………04页 2 系统整体架构(Architecture Description) ……………04页 2.1 设计思路…………………………………………………04页 2.2 系统原理(包含:框图等阐述与设计说明等内容)…04页 3 系统设计 (含HDL或原理图输入设计)………………………05页 3.1 HDL 代码…………………………………………………05页 3.2 系统整体电路图(或RTL级电路图)…………………12页 4 系统仿真(Simulation Waveform)…………………………13页 5 FPGA实现(FPGA Implementation) ………………………14页 总结(Closing)………………………………………………16页 参考书目(Reference):…………………………………………16页 一、项目名称、内容与要求 二、系统整体架构(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 --实体名为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,hit11,hit22:in std_logic; --甲和乙的击球输入端口 light:out std_logic_vector(1 to 8); sound:out std_logic;--控制8个发光二极管的输出端口 music_begin:out std_logic;--控制音乐开始的输出端口 counta,countb,countc,countd,counte,countf:out std_logic_vector(3 downto 0)); --2个用于控制4个7段译码器的输出端口 end compete; architecture one of compete is type 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,count5,count6:std_logic_vector(3 downto 0):=0000; ---内部计数器,是4位二进制变量 begin process(clk_1) begin if(clk_1event and clk_1=1) then if count1=1 and count5=1 or count2=1 and count6=1 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=0;count2=0;count5=0;count6=0; elsif clk_1event and clk_1=1 then --当处于时钟inclock上升沿时 if count1=10 then count1=0;count
显示全部
相似文档