本帖最后由 gaominjie 于 2021-12-23 13:36 编辑
谢谢您的耐心指导!我试着用第2种方法,可我没有准确理解您的意思,而且代码也不一定对,等您有空了再指点我一下。谢谢!
signal OUT_A: std_logic;
signal INBUF: std_logic_vector(0 to 1);
process(CLK)
begin
if CLK'event and CLK = '1' then
INBUF(0) <= IN_PIN;
INBUF(1) <= INBUF(0);
end if;
end process;
process(CLK)
variable CNT3: integer range 0 to 3;
begin
if CLK'event and CLK = '1' then
if INBUF(0) = '1' and INBUF(1) = '0' then --IN上升沿
OUT_A <= '1';
CNT3 := CNT3 + 1;
end if;
if CNT3 = 3 then
CNT3 := 0;
OUT_A <= '0';
end if;
OUT_PIN <= OUT_A or INBUF(0);
end if;
end process;
|