运行环境:Quartus II 9.0sp2 Web Edition
--****************Library*****************
LIBRARY IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
--****************Entity******************
ENTITY liushuideng IS
PORT( clk, rst : IN STD_LOGIC;
led : OUT STD_LOGIC_VECTOR(7 downto 0));
END ENTITY;
--*************Architecture****************
ARCHITECTURE one OF liushuideng IS
signal clk2 : std_logic;
begin
process(clk)
variable cnt : integer range 0 to 1000000000;
begin
if (clk'event and clk = '1') then
if (rst = '1') then
if (cnt < 12500000) then
cnt := cnt + 1;
else
cnt := 0;
clk2 <= not clk2;
end if;
else
cnt := 0;
end if;
end if;
end process;
process(clk2)
variable state : integer range 0 to 8;
begin
if(rst = '1') then
if(clk2'event and clk2 = '1') then
state :=