fpga的循环彩灯实验程序,有一段看不懂
--********************************************
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
--********************************************
ENTITY light is
PORT(
clk1 : IN STD_LOGIC;
light: buffer std_logic_vector(7 downto 0)
key : in std_logic_vector(5 downto 0) --修改为std_logic_vector(2 downto 0)
);
END light;
--*********************************************
ARCHITECTURE behv OF light IS
constant len : integer:=7;
signal banner : STD_LOGIC:='0';
signal clk,clk2: STD_LOGIC;
BEGIN
clk<=clk1;
process (clk)
if clk'event and clk='1' then
if key="000001"then
if flag="000" then
light<='1' & light(len downto 1);
if light(1)='1' then
flag:="001";
end if;
elsif flag="001" then
light<=light (len-1 downto 0) & '0';
if light(6)='0' then
flag:="000";
end if;
end if;
elsif key="000010"then
if flag="000" then
light<= light(len-1 downto 0) & '1';
if light(6)='1' then
flag:="001";
end if;
elsif flag="001" then
light<='0' & light (len downto 1) ;
if light(1)='0' then
flag:="000";
end if;
end if;
elsif key="000100" then
if flag="000" then
light(len downto 4) <=light (len-1 downto 4)&'1';
light(len-4 downto 0) <='1'& light(len-4 downto 1);
if light(0)='1' then
flag:="001";
end if;
elsif flag="001" then
light(len downto 4) <='0'& light(len downto 5);
light(len-4 downto 0) <= light(len-5 downto 0)&'0';
if light(2)='0' then
flag:="000";
end if;
end if;
elsif key="001000" then
if flag="000" then
light(len downto 4)<='1'&light(len downto 5);
light(len-4 downto 0) <=light(len-5 downto 0)&'1';
if light(3)='1' then
flag:="001";
end if;
elsif flag="001" then
light(len downto 4) <=light (len-1 downto 4)&'0';
light(len-4 downto 0) <= '0'& light(len-4 downto 1);
if light(1)='0' then
flag:="000";
end if;
end if;
elsif key="010000" then
light<="11111111";
flag:="000";
elsif key="000000" then
light<="00000000";
flag:="000";
end if;
end if;
end process;
end behv;
if key="000001" 这一段是8个led从左到右依次点亮,这一段程序每步的意义是什么?谢谢!
已退回10积分
