各位大侠帮忙分析下这个流水灯程序!!!!!谢谢!!
程序下载进去以后,灯全亮了。library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity lled is
port(
clk:in std_logic;
dout:out std_logic_vector(7 downto 0)
);
end lled;
architecture behav of lled is
signal q:std_logic_vector(7 downto 0);
signal d:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if clk'event and clk='1'then
d<=d+1;
end if;
case d is
when"0000"=>dout<="1000000000000000" after 10 ms;
when"0001"=>dout<="0100000000000000" after 10 ms;
when"0010"=>dout<="0010000000000000" after 10 ms;
when"0011"=>dout<="0001000000000000" after 10 ms;
when"0100"=>dout<="0000100000000000" after 10 ms;
when"0101"=>dout<="0000010000000000" after 10 ms;
when"0110"=>dout<="0000001000000000" after 10 ms;
when"0111"=>dout<="0000000100000000" after 10 ms;
when"1000"=>dout<="0000000010000000" after 10 ms;
when"1001"=>dout<="0000000001000000" after 10 ms;
when"1010"=>dout<="0000000000100000" after 10 ms;
when"1011"=>dout<="0000000000010000" after 10 ms;
when"1100"=>dout<="0000000000001000" after 10 ms;
when"1101"=>dout<="0000000000000100" after 10 ms;
when"1110"=>dout<="0000000000000010" after 10 ms;
when "1111"=>dout<="0000000000000001" after 10 ms;
when others=>dout<="XXXXXXXXXXXXXXXX";
end case;
end process;
end behav; 时钟过快,灯变化的时间间隔太短,肉眼看不出来,建议时钟分频看看。 回复 2# 至芯兴洪
谢谢。。。。。。。 楼上说的很对,时钟频率过高,超过人眼的分辨频率,可以将系统时钟进行分频,降低频率 你没看看那个晶振频率多少??
:)
页:
[1]