LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
--USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY grab IS
PORT(
Clk: in std_logic;
Sw1: in std_logic;
Sw2: in std_logic;
Led1: out std_logic;
Led2: out std_logic
);
END grab;
ARCHITECTURE grab OF grab IS
BEGIN
PROCESS(Clk)
variable flag:std_logic;
variable Number:integer range 1 to 10000000;
BEGIN
if Clk'event and Clk='0' then
Number:=Number+1;
if flag='1'and Number=10000000 then
Led1<='0';
Led2<='0';
flag:='0';
elsif flag='0' then
if Sw1='1' then
Led1<='1';
elsif Sw2='1'then
Led2<='1';
end if;
flag:='1';
Number:=1;
end if;
end if;
END PROCESS;
END grab;
电脑抢答器网 抢答器设计与制作的专业网站 大学生课程设计的园地 |