N
Neil Zanella
Guest
Hello,
I have come across the following VHDL example describing a D flip-flop
with preset and clear. It seems to me that clr and pr can be omitted
entirely from the process's sensitivity list as the only time one
of these will change is when clr_l or pr_l will change. Is this
so or do the signals clr and pr (clear and preset) really have
to be included in the sensitivity list as well?
Thanks,
Neil
library ieee;
use ieee.std_logic_1164.all;
entity ff is
port (d, clk, pr_l, clr_l: in std_logic;
q, qn: out std_logic);
end entity ff;
architecture arch of ff is
signal pr, clr: std_logic;
begin
process (clr_l, clr, pr_l, pr, clk) is
begin
pr <= not pr_l; clr <= not clr_l;
if (clr and pr) = '1' then q <= '0'; qn <= '0';
elsif clr = '1' then q <= '0'; qn <= '1';
elsif pr = 'q' then q <= '1; qn <= '0';
elsif rising_edge(clk) then q <= d; qn <= not d;
end if;
end process;
end architecture arch;
I have come across the following VHDL example describing a D flip-flop
with preset and clear. It seems to me that clr and pr can be omitted
entirely from the process's sensitivity list as the only time one
of these will change is when clr_l or pr_l will change. Is this
so or do the signals clr and pr (clear and preset) really have
to be included in the sensitivity list as well?
Thanks,
Neil
library ieee;
use ieee.std_logic_1164.all;
entity ff is
port (d, clk, pr_l, clr_l: in std_logic;
q, qn: out std_logic);
end entity ff;
architecture arch of ff is
signal pr, clr: std_logic;
begin
process (clr_l, clr, pr_l, pr, clk) is
begin
pr <= not pr_l; clr <= not clr_l;
if (clr and pr) = '1' then q <= '0'; qn <= '0';
elsif clr = '1' then q <= '0'; qn <= '1';
elsif pr = 'q' then q <= '1; qn <= '0';
elsif rising_edge(clk) then q <= d; qn <= not d;
end if;
end process;
end architecture arch;