EDA4人抢答器设计报告_4人抢答器程序报告
EDA4人抢答器设计报告由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“4人抢答器程序报告”。
四人抢答器
一、设计任务:
l、设计用于竞赛的四人抢答器,功能如下:(1)有多路抢答器,台数为四;
(2)具有抢答开始后20秒倒计时,20秒倒计时后无人抢答显示超时,并报警;(3)能显示超前抢答台号并显示犯规警报;(4)能显示各路得分,并具有加、减分功能;
2、系统复位后进入抢答状态,当有一路抢答键按下时,该路抢答信号将其余各路抢答封锁,同时铃声响,直至该路按键松开,显示牌显示该路抢答台号。
3、用VHDL语言设计符合上述功能要求的四人抢答器,并用层次设计方法设计该电路
二、设计思路:
将该任务分成三个模块进行设计,分别为:抢答器鉴别模块、抢答器计时模块、抢答器记分模块,最后是撰写顶层文件。
1、抢答器鉴别模块:
在这个模块中主要实现抢答过程中的抢答功能,并能对超前抢答进行警告,还能记录无论是正常抢答还是朝前抢答者的台号,并且能实现当有一路抢答按键按下时,该路抢答信号将其余个绿抢答封锁的功能。其中有四个抢答信号a、b、c、d;抢答使能信号en;抢答状态显示信号states;警报时钟信号clk2;系统复位信号rst;超前警报信号ring。
2、抢答器计时模块:
在这个模块中主要实现抢答过程中的计时功能,在有抢答开始后进行20秒的倒计时,并且在20秒倒计时后无人抢答显示超时并报警。其中有抢答时钟信号clk;系统复位信号rst;抢答使能信号en;抢答状态显示信号states;无人抢答警报信号warn;计时中止信号stop;计时十位个位信号tb,ta。
3、抢答器记分模块:
在这个模块中主要是给四个抢答信号记分,并给每个抢答信号预置5分,当抢答并答对时加1分,答错减1分,没有获得抢答保持不变。其中有抢答时钟信号clk;系统复位信号rst;抢答使能信号en;抢答状态显示信号states;记分加减信号add(add=‘1’时为加,add=‘0’时为减);四个信号的得分显示信号a_out,b_out,c_out,d_out。
4、顶层文件:
在这个模块中是对前三个模块的综合编写的顶层文件。
三、具体实施:
1、本设计的实现电路图:
2、本设计的源程序:
library ieee;--抢答鉴别模块 use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity qdjb is
port(clk2,en,rst:in std_logic;
a,b,c,d:in std_logic;
ring:out std_logic;
states:out downto 0));end qdjb;architecture one of qdjb is signal sinor,ringf,tmp:std_logic;signal cnt:std_logic_vector(5 downto 0);begin sinor
begin
if rst='1' then
tmp
elsif tmp='1' then
if a='1' then
states
elsif b='1' then
states
elsif c='1' then
states
elsif d='1' then
states
else tmp
end if;
end if;end proce p1;p2roce(clk2,en,rst,cnt)
begin
if rst='1' then
cnt
elsif clk2'event and clk2='1' then
if en='0' and sinor='1' then
if cnt
ringf
else ringf
end if;
end if;
end if;end proce p3;ring
library ieee;--抢答器计时模块 use ieee.std_logic_1164.all;std_logic_vector(3 use ieee.std_logic_unsigned.all;entity js is
port(clk,rst,en,stop:in std_logic;
warn:buffer std_logic;
ta,tb:buffer std_logic_vector(3 downto 0));end js;architecture one of js is signal co:std_logic;begin p1:proce(clk,rst,en,stop,ta)
begin
if rst='1' or stop='1' then
ta
elsif clk'event and clk='1' then
co
if en='1' then
if ta=“0000” then
ta
else ta
end if;
end if;
end if;end proce p1;p2:proce(co,rst,en,stop,tb)
begin
if rst='1' or stop='1' then
tb
elsif co'event and co='1' then
if en='1' then
if tb=“0000” then tb
else tb
end if;
end if;
end if;end proce p2;p3:proce(rst,ta,tb)
begin
if rst='1' then
warn
elsif ta=“0000” and tb=“0000” then
warn
else warn
end if;end proce p3;end one;
library ieee;--抢答器记分模块 use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jf is
port(clk,rst,en,add:in std_logic;
states:in std_logic_vector(3 downto 0);
a_out,b_out,c_out,d_out:buffer std_logic_vector(3 downto 0));end jf;
architecture one of jf is begin
p2:proce(clk,rst,add,states,a_out,b_out,c_out,d_out)
begin
if(rst='1')then
a_out
elsif en='1'then
if clk'event and clk='1' then
case states is
when “0001”=>
if add='1' then
if a_out=“1111” then
a_out
else a_out
end if;
elsif add='0' then
if a_out=“0000” then
a_out
else a_out
end if;
end if;
when “0010”=>
if add='1' then
if b_out=“1111” then
b_out
else b_out
end if;
elsif add='0' then
if b_out=“0000” then
b_out
else b_out
end if;
end if;
when “0011”=>
if add='1' then
if c_out=“1111” then
c_out
else c_out
end if;
elsif add='0' then
if c_out=“0000” then
c_out
else c_out
end if;
end if;
when “0100”=>
if add='1' then
if d_out=“1111” then
d_out
else d_out
end if;
elsif add='0' then
if d_out=“0000” then
d_out
else d_out
end if;
end if;
when others=>
a_out
end case;
end if;
end if;
end proce p2;end one;
library ieee;--抢答器顶层文件 use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity qiangda is
port(clk,clk2,en,a,b,c,d,add,stop,rst:in std_logic;
ring,alarm:out std_logic;
ta,tb:buffer std_logic_vector(3 downto 0);
states:buffer std_logic_vector(3 downto 0);
a_out,b_out,c_out,d_out:buffer std_logic_vector(3 downto 0));end qiangda;
architecture bhv of qiangda is component qdjb is
port(clk2,en,rst:in std_logic;
a,b,c,d:in std_logic;
ring:out std_logic;
states:out std_logic_vector(3
downto 0));end component;component js is
port(clk,rst,en,stop:in std_logic;
warn:buffer std_logic;
ta,tb:buffer std_logic_vector(3 downto 0));end component;
component jf is
port(clk,rst,en,add:in std_logic;
states:in downto 0);
a_out,b_out,c_out,d_out:buffer std_logic_vector(3 downto 0));end component;signal cnt:std_logic_vector(3 downto 0);std_logic_vector(3
begin
u1:qdjb port map(clk2,en,rst,a,b,c,d,ring,states);u2:js port map(clk,rst,en,stop,alarm,ta,tb);u3:jf;end bhv;
port
map(clk,rst,en,add,states,a_out,b_out,c_out,d_out)
四、结果分析:
(一)、软件分析:
1、抢答器鉴别模块:
编译报告:
仿真结果:
2、抢答器计时模块:
编译报告:
仿真结果:
3、抢答器记分模块:
编译报告:
仿真结果:
4、抢答器顶层模块:
编译报告:
仿真结果:
顶层文件的RTL级:
管脚锁定图:
(二)、硬件分析:
五、参考文献:
Vb开办上海电力学院课程设计报告信息工程系抢答器设计报告一、设计目的:本课程的授课对象是电子科学与技术专业本科生,是电子类专业的一门重要的实践课程,是理论与实践相结合的......
目录1.设计任务和要求…………………………………….3 2.设计方案…………………………………………….3 2.1 设计思路………………………………………3 2.2 设计原理………......
简易抢答器设计一.设计目的1、通过本课程设计的学习,学生将复习所学的专业知识,使课堂学习的理论知识应用于实践,通过本课程设计的实践使学生具有一定的实践操作能力;2、掌握Quar......
回顾上一周课程设计的时间,收获了很多,也付出了很多,周一至周二主要熟悉ewb软件的操作使用,学会仿真,周三至周四是看书查找资料,对相关元器件做一些了解,并把元器件布好线,以待焊接,......
四路抢答器摘 要:近年来随着科技的飞速发展,单片机、PLC的应用不断地走向深入,同时带动传统的控制检测技术的不断更新,可编程控制器由于其优良的控制性能,极高的可靠性,在各行各业......
