EDA课程设计报告--EDA数字抢答器(2)

2019-01-27 15:21

nsinor<=not(a or b or c or d); start<=s_start; process(sta,nsinor) is begin

if (sta='1') then s_start<='1';

elsif(nsinor'event and nsinor='1')then s_start<='0'; end if; end process;

process(rst,sta,sinor,nsinor) is begin

if(rst='1' or sta='1' or nsinor='1')then a1<='0';b1<='0';c1<='0';d1<='0'; elsif(sinor'event and sinor='1')then if(s_start='1')then if(a='1')then

a1<='1';b1<='0';c1<='0';d1<='0'; elsif(b='1')then

a1<='0';b1<='1';c1<='0';d1<='0'; elsif(c='1')then

a1<='0';b1<='0';c1<='1';d1<='0'; elsif(d='1')then

a1<='0';b1<='0';c1<='0';d1<='1'; end if; end if; end if; end process; process(sinor) is

6

begin

if(rst='1')then states<=\

elsif(sinor'event and sinor='1')then if(s_start='1')then if(a='1')then states<=w1; elsif(b='1')then states<=w2; elsif(c='1')then states<=w3; elsif(d='1')then states<=w4; end if; end if; end if; end process;

end architecture art;

7

3.1.3抢答鉴别模块的时序仿真图

图 4.1

抢答开始后,A组按下抢答键,抢答成功

8

3.2抢答器的抢答计时模块

3.2.1抢答计时模块的功能

主持人宣布抢答成功后,按下EN键,选手开始回答,系统开始计时。TA和TB键选择计时的时间(TA:9秒,TB:7秒)

3.2.2 抢答计时模块的源程序

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity js is

port(clr,ldn,en,clk:in std_logic; ta,tb: in std_logic;

qa: out std_logic_vector(3 downto 0); qb: out std_logic_vector(3 downto 0)); end entity js;

architecture art of js is

signal da: std_logic_vector(3 downto 0); signal db: std_logic_vector(3 downto 0); begin

process(ta,clr) is begin

if(clr='1')then da<=\

elsif(ta'event and ta='1')then if(ldn='1')then if(da=\ da<=\

9

else

da<=da-1; end if; end if; end if; end process; process(tb,clr) is begin

if(clr='1')then db<=\

elsif(tb'event and tb='1')then if(ldn='1')then if db=\ db<=\ else

db<=db-1; end if; end if; end if; end process; process(clk) is

variable tmpa: std_logic_vector(3 downto 0); variable tmpb: std_logic_vector(3 downto 0); begin

if(clr='1')then tmpa:=\ tmpb:=\

elsif clk'event and clk='1' then if en='1'then

10


EDA课程设计报告--EDA数字抢答器(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:沪科版九年级上数学试卷

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: