|
大家好,我刚刚学习VHDL,今天写了一个小程序,开始程序里有reset信号的时候程序运行正常,可是当我去掉reset信号的时候所有的LED灯全亮了,到底是程序哪里出现问题了?
程序如下:
--库函数声明及调用
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
--实体定义
entity led is
port(clk,reset: in std_logic; --,reset
led8: out std_logic_vector(7 downto 0));
end led;
--结构体
architecture one of led is
signal num : std_logic_vector(7 downto 0):="11111110";
signal clock:std_logic;
begin
--分频进程
--分频后的值:50000000/5000/2000=5HZ
process(clk)
variable cnt1 : integer range 0 to 5000;
variable cnt2 : integer range 0 to 1000;
begin
if clk'event and clk='1' then
if cnt1=5000 then
cnt1:=0;
if cnt2=1000 then
cnt2:=0;
clock<=not clock;
else
cnt2:=cnt2+1;
end if;
else
cnt1:=cnt1+1;
end if;
end if;
end process;
--移位操作
--process(clock) --reset,
process(clock)
begin
-- if reset='0' then
-- num<="11111110";
if clock'event and clock='1' then
num(7 downto 1) <= num(6 downto 0);
num(0) <= num(7);
end if;
end process;
led8<=num;
end one; |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|