我想实现的功能是:上电后,led灭,当按键按下一后,对应的led点亮,即使按键松开,led依然亮,我的程序如下:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY TEST_1 IS
PORT(S:IN STD_LOGIC;
L:OUT STD_LOGIC;
NUM:BUFFER INTEGER RANGE 0 TO 1:=0);
END TEST_1;
ARCHITECTURE ONE OF TEST_1 IS
BEGIN
PROCESS(S)
BEGIN
IF(S='0') THEN
NUM<=1;
END IF;
END PROCESS;
PROCESS(NUM)
BEGIN
CASE NUM IS
WHEN 0=>L<='0';
WHEN 1=>L<='1';
END CASE;
END PROCESS;
END ONE;
但是上电后对应的灯就亮了.....郁闷,请大家帮助一下,谢谢! |