tmpa:=da; tmpb:=db; elsif tmpa=\ if tmpb=\ tmpa:=\ else
tmpa:=\ end if;
if tmpb=\ tmpb:=\ else
tmpb:=tmpb-1; end if; else
tmpa:=tmpa-1; end if; end if; qa<=tmpa; qb<=tmpb; end process;
end architecture art;
11
3.2.3抢答计时模块的时序仿真图
图 5.1
按下EN开始答题,回答问题时,选择TA模式计时
12
3.3 抢答器的译码显示模块
3.3.1译码显示模块的功能
译码显示模块用于显示每组选手的分数,计时的的时间等信息。
3.3.2译码显示模块的源程序
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity ym is
port(in4: in std_logic_vector(3 downto 0); out7:out std_logic_vector(6 downto 0)); end ym;
architecture art of ym is begin process(in4) begin case in4 is
when\ when\ when\ when\ when\ when\ when\ when\ when\
13
when\ when others=>out7<=\ end case; end process; end architecture;
3.3.3译码显示模块的时序仿真图
图 7.1
输入0001,输出0000110,在共阴极数码管上显示1
14
3.4抢答器的其他功能模块
3.4.1其他功能模块的具体信息
犯规功能模块:但主持人未按下START键时,若有选手按抢答键,系统报警。
犯规功能模块的源程序: library ieee;
use ieee.std_logic_1164.all; entity fg is
port(a,b,c,d,start:in std_logic; y:out std_logic); end fg;
architecture bhv of fg is begin
process(a,b,c,d,start) begin
if start='0' then
if (a or b or c or d)='1' then y<='1'; end if; else y<='0'; end if; end process; end architecture;
15