FPGA抢答器设计报告精品资料.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《FPGA抢答器设计报告精品资料.doc》由会员分享,可在线阅读,更多相关《FPGA抢答器设计报告精品资料.doc(28页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、 Vb开办上海电力学院课程设计报告信息工程系抢答器设计报告一、 设计目的: 本课程的授课对象是电子科学与技术专业本科生,是电子类专业的一门重要的实践课程,是理论与实践相结合的重要环节。 本课程有助于培养学生的数字电路设计方法、掌握模块划分、工程设计思想与电路调试能力,为以后从事各种电路设计、制作与调试工作打下坚实的基础二、 实验器材和工具软件: PC机一台、QuartusII软件、DE2板。三、 设计内容:(1)抢答器可容纳四组12位选手,每组设置三个抢答按钮供选手使用。(2)电路具有第一抢答信号的鉴别和锁存功能。在主持人将系统复位并发出抢答指令后,蜂鸣器提示抢答开始,时显示器显示初始时间并开
2、始倒计时,若参赛选手按抢答按钮,则该组指示灯亮并用组别显示器显示选手的组别,同时蜂鸣器发出“嘀嘟”的双音频声。此时,电路具备自锁功能,使其它抢答按钮不起作用。(3)如果无人抢答,计时器倒计时到零,蜂鸣器有抢答失败提示,主持人可以按复位键,开始新一轮的抢答。(4)设置犯规功能。选手在主持人按开始键之前抢答,则认为犯规,犯规指示灯亮和显示出犯规组号,且蜂鸣器报警,主持人可以终止抢答执行相应惩罚。(5)抢答器设置抢答时间选择功能。为适应多种抢答需要,系统设有10秒、15秒、20秒和3O秒四种抢答时间选择功能 。四、 设计具体步骤: 首先把系统划分为组别判断电路模块groupslct,犯规判别与抢答信
3、号判别电路模块fgqd,分频电路模块fpq1,倒计时控制电路模块djs,显示时间译码电路模块num_7seg模块,组别显示模块showgroup模块这六个模块,各模块设计完成后,用电路原理图方法将各模块连接构成系统。各模块功能及代码:1、 组别判别模块(1) 功能:可容纳四组12位选手,每组设置三个抢答按钮供选手使用。若参赛选手按抢答按钮,则输出选手的组别。此时,电路具备自锁功能,使其它抢答按钮不起作用。(2)原理:在每次时钟(50MHz)上升沿时判断按键,将按下按键的组别赋给一内部信号“h”(没有按键按下时h=“0000”),由于人的反应速度远远小于50MHz,所以可选出最先按下按键的那组。
4、当复位键按下时(clr=1)输出g=“0000”并且将另一内部信号rst置1。当复位后(rst=1)有按键按下时将h的值给输出信号g,并且将标志信号rst清零。这样就实现最快按键组别的输出与组别锁存功能。(3)程序代码:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity groupslct is port( clock,clr:in std_logic; a,b,c,d:in std_logic_vector(2 downto 0); g:out std_logic_vector(
5、3 downto 0) ); end groupslct; architecture behave_groupslct of groupslct is signal h : std_logic_vector(3 downto 0);signal rst : std_logic;begin h=0000 when (a=000 and b=000 and c=000 and d=000) else 0001 when (a/=000 and b=000 and c=000 and d=000) else 0010 when (a=000 and b/=000 and c=000 and d=00
6、0) else 0100 when (a=000 and b=000 and c/=000 and d=000) else 1000 when (a=000 and b=000 and c=000 and d/=000) else 0000;process begin wait on clock until rising_edge(clock); if clr=1 then rst=1; g=0000; end if; if h/=0000 then if rst=1 then g=h; rst=0; end if; end if; end process; end behave_groups
7、lct;2、 犯规判别与抢答信号判别模块(1)功能:若参赛选手在主持人按开始键之后按抢答按钮,则使该组指示灯亮并输出选手的组别,同时蜂鸣器发出响声。选手在主持人按开始键之前抢答,则认为犯规,犯规指示灯亮并输出犯规组号,且蜂鸣器报警。(2) 原理:c3.0接组别判别模块的g3.0,即此时c为按键组别的信息。go接主持人的“开始”按键。由于无论是在正常情况还是犯规情况下按下按键,都必须显示按键的组别且蜂鸣器响,所以将c的值给hex以输出按键组别,且在有按键按下(c/=0000)时输出fm为1,否则为0。若在开始之前有按键按下时,即go=0且c/=0000,输出ledfg为1,否则为0。若在开始之后
8、有按键按下,将c的值给led,使该组指示灯亮,开始之前led输出“0000”。(3) 程序代码:library ieee; use ieee.std_logic_1164.all; entity fgqd is port( c:in std_logic_vector(3 downto 0); go:in std_logic; hex:out std_logic_vector(3 downto 0); led:out std_logic_vector(3 downto 0); ledfg,fm:out std_logic); end fgqd; architecture behave_fgqd
9、of fgqd is begin hex=c; led=c when go=1 else 0000; ledfg=1 when go=0 and c/=0000 else 0; fm=1 when c/=0000 else 0;end behave_fgqd; 3、倒计时控制电路模块(1) 功能:设置10秒、15秒、20秒和3O秒四种抢答时间选择功能,输出时间,并判断计时是否到0。(2) 原理:clock接1Hz分频器,grpsl接组别判别模块的输出g。通过判断s的值设置内部减法计数器的初始值q端输出当前计数值。当计数到0且grpsl=“0000”时time0输出高电平以驱动蜂鸣器,发出时间到
10、的警报。(3) 程序代码library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity djs is port( clock,en,aclr:in std_logic; s:in std_logic_vector(1 downto 0); grpsl:in std_logic_vector(3 downto 0); q:buffer std_logic_vector(4 downto 0); time0:out std_logic ); end djs; architecture behave
11、_djs of djs is begin process(clock,aclr,s) begin if (aclr=1) then if (s=00) then q=01010; elsif (s=01) then q=01111; elsif (s=10) then q=10100; else q=11110; end if; else if rising_edge(clock) then if en=1 then q=q-1; if (q=00000 and grpsl=0000) then time0=1; else time0=0; end if; end if; end if; en
12、d if; end process; end behave_djs; 4、分频器模块 (1)功能:实现50MHz1Hz的分频,为倒计时模块提供时钟。(2) 程序代码library ieee; use ieee.std_logic_1164.all; entity fpq1 is port( clkin :in std_logic; clkout:out std_logic); end fpq1; architecture behave_fpq1 of fpq1 is constant N: Integer:=24999999;signal Counter:Integer RANGE 0 TO
13、N; signal Clk: Std_Logic;begin process(clkin) begin if rising_edge(clkin) then -每计到N个(0n-1)上升沿,输出信号翻转一次 if Counter=N then Counter=0; Clk=NOT Clk; else Counter= Counter+1; end if; end if; end process; clkout= Clk; end behave_fpq1; 5、时间显示译码器(1)功能:将时间信息在7段数码管上显示。(2)程序代码library ieee; use ieee.std_logic_
14、1164.all; entity num_7seg is port( c:in std_logic_vector(4 downto 0); hex:out std_logic_vector(13 downto 0); end num_7seg; architecture behave_num_7seg of num_7seg is begin with c(4 downto 0) select hex= 10000001000000 when 00000 , -0 10000001111001 when 00001 , -1 10000000100100 when 00010 , -2 100
15、00000110000 when 00011 , -3 10000000011001 when 00100 , -4 10000000010010 when 00101 , -5 10000000000010 when 00110 , -6 10000001111000 when 00111 , -7 10000000000000 when 01000 , -8 10000000010000 when 01001 , -9 11110011000000 when 01010 , -10 11110011111001 when 01011 , -11 11110010100100 when 01
16、100 , -12 11110010110000 when 01101 , -13 11110010011001 when 01110 , -14 11110010010010 when 01111 , -15 11110010000010 when 10000 , -16 11110011111000 when 10001 , -17 11110010000000 when 10010 , -18 11110010010000 when 10011 , -19 01001001000000 when 10100 , -20 01001001111001 when 10101 , -21 01
17、001000100100 when 10110 , -22 01001000110000 when 10111 , -23 01001000011001 when 11000 , -24 01001000010010 when 11001 , -25 01001000000010 when 11010 , -26 01001001111000 when 11011 , -27 01001000000000 when 11100 , -28 01001000010000 when 11101 , -29 01100001000000 when 11110 , -30 11111111111111
18、 when others; - end behave_num_7seg;6、组别显示译码器(显示组别)(1)功能:将组别信息显示在7段数码管上。(2)程序代码library ieee; use ieee.std_logic_1164.all; entity showgroup is port( c:in std_logic_vector(3 downto 0); hex:out std_logic_vector(6 downto 0); end showgroup; architecture behave_showgroup of showgroup is begin with c(3 dow
19、nto 0) select hex= 1111001 when 0001 , -1 0100100 when 0010 , -2 0110000 when 0100 , -3 0011001 when 1000 , -4 1111111 when others; - end behave_showgroup;7、用原理图方法将各模块连接起来构成系统五、 设计收获以及存在的问题: 在这次课程设计中,我做的题目是抢答器的设计。我的设计思想是先将整个系统划分为组别判断电路模块groupslct,犯规判别与抢答信号判别电路模块fgqd,分频电路模块fpq1,倒计时控制电路模块djs,显示时间译码电路模
20、块num_7seg模块,组别显示模块showgroup模块这六个模块,各模块设计完成后,用电路原理图方法将各模块连接构成系统。其中组别判断电路模块groupslct的设计着实让我费了不少时间。此模块首先的一个功能就是选出最快按键的那组。我想,由于人的反应速度远远小于50MHz,各组之间按键时间间隔远大于1/50M s,所以在每次时钟(50MHz)上升沿时判断按键,便可将最快的一组选出来。然后就是将选出的组别锁存。将按下按键的组别赋给一内部信号“h”(没有按键按下时h=“0000”),当复位键按下时(clr=1)输出g=“0000”并且将另一内部信号rst置1。当复位后(rst=1)有按键按下时
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- FPGA抢答器设计报告 精品资料 FPGA 抢答 设计 报告 精品 资料
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内