如果复位信号是' 0'那么" EN"走高," clr"变低了。但是,如果复位信号在时钟的上升沿变高,那么" EN"走低了" clr"很高兴。我在我的代码中实现了这一点,但是我需要延迟当复位变为高电平[EN = 0 / CLR = 1]时产生的输出信号再持续3个时钟周期。我尝试使用计数器,但它产生了相同的答案。
BEGIN
process ( Reset, Clk)
begin
if Reset = '0' then
En <= '1';
clr <= '0';
elsif rising_edge(Clk) then
if Reset = '1' then
En <= '0';
clr <= '1';
end if;
end if;
end process;
END description;
答案 0 :(得分:1)
延迟信号由3位移位寄存器完成,或者在您的情况下由3链式D-FF完成。
将寄存器移位为oneliner:
architecture rtl of myEntity is
signal clr_sr : std_logic_vector(2 downto 0) := "000";
signal en_sr : std_logic_vector(2 downto 0) := "000";
signal clr_delayed : std_logic;
signal en_delayed : std_logic;
[...]
begin
[...]
process(Reset, Clk)
begin
if Reset = '0' then
en <= '1';
clr <= '0';
elsif rising_edge(Clk) then
en <= '0';
clr <= '1';
end if;
end process;
clr_sr <= clr_sr(clr_sr'high - 1 downto 0) & clr when rising_edge(Clock);
en_sr <= en_sr(en_sr'high - 1 downto 0) & en when rising_edge(Clock);
clr_delayed <= clr_sr(clr_sr'high);
en_delayed <= en_sr(en_sr'high);
[...]
end;
甚至更短的函数sr_left来封装移位功能:
clr_sr <= sr_left(clr_sr, clr) when rising_edge(Clock);