- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2 数字抢答器的设计
2.1 二人数字抢答器的设计
一、设计任务:设计一个2人抢答器,采用EPM7128芯片,具体要求如下:
两人抢答,先抢为有效,用发光二极管显示是否抢到优先答题权。
每人2位计分显示,答错不加分,答对加10分、20分、30分。
每题结束后,裁判按复位,可重新抢答下一题。
累计加分可由裁判随时清除。
二、设计框图:
抢答者1抢答者2抢答判断
抢答者1
抢答者2
抢答判断
显示抢答指示灯
裁判复位
重新抢答
裁判加分
裁判清零
加分电路
显示加分结果
源程序:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity qd is
port(i1,i2:in bit;
reset:in bit;
g10,g20,g30:in bit;
clk:in bit;
cong:in bit
light1, light2:out bit= ’0 ’;
t11:out std_logic_vector(6 downto 0):=”0111111”;
t12:out std_logic_vector(6 downto 0):=”0111111”;
t21:out std_logic_vector(6 downto 0):=”0111111”;
t22:out std_logic_vector(6 downto 0):=”0111111”);
end qd;
architecture stru of qd is
signal cs1:integer range 0 to 9;
signal cs2:integer range 0 to 9;
signal a,b:bit:= ’0’;
signal 11,12:bit:= ’0’;
begin
process(clk)
begin
if clk’event and clk = ’1 ’then
if (cong = ’1 ’) then
if (reset = ’1 ’) then
if (i1 = ’0 ’and a = ’0 ’) then 11 =’1 ’;
elsif(i2 = ’0 ’and a = ’0 ’) then 12 =’1 ’;a =’1 ’;
end if;
if (g10=’0’and 11= ’1 ’and b= ’0 ’)then cs1=cs1+1;b=’1 ’;
elsif(g20=’0’and 11= ’1 ’and b= ’0 ’)then cs1=cs1+2;b=’1 ’;
elsif(g30=’0’and 11= ’1 ’and b= ’0 ’)then cs1=cs1+3;b=’1 ’;
end if;
if (g10=’0’and 12= ’1 ’and b= ’0 ’)then cs2=cs2+1;b=’1 ’;
elsif(g20=’0’and 12= ’1 ’and b= ’0 ’)then cs2=cs2+2;b=’1 ’;
elsif(g30=’0’and 12= ’1 ’and b= ’0 ’)then cs2=cs2+3;b=’1 ’;
end if;
if (cs1 = 0) then t11=;
elsif (cs1 = 1) then t11=”0000110”;
elsif (cs1 = 2) then t11=”1011011”;
elsif (cs1 = 3) then t11=”1001111”;
elsif (cs1 = 4) then t11=”1100110”;
elsif (cs1 = 5) then t11=;
elsif (cs1 = 6) then t11=”1111101”;
elsif (cs1 = 7) then t11=”0000111”;
elsif (cs1 = 8) then t11=”1111111”;
elsif (cs1 = 9) then t11=”1101111”;
end if;
if (cs2 = 0) then t21=;
elsif (cs2 = 1) then t21=”0000110”;
elsif (cs2 = 2) then t21=”1011011”;
elsif (cs2 = 3) then t21=”1001111”;
elsif (cs2 = 4) then t21=”11001
文档评论(0)