library ieee;
use ieee.std_logic_1164.all;
entity dev is
port(
a,b,c,d : in std_logic;
q : out std_logic
);
end dev;
architecture behavioral of dev is
signal s : std_logic;
begin
process( a,b,c,d,s )
begin
if ( d = '1' ) then
s <= '0';
elsif falling_edge( a ) then
if ( b = '1' ) then
if ( c = '1' ) then
s <= not s;
else
s <= '1';
end if;
elsif ( c = '1' ) then
s <= '0';
end if;
end if;
end process;
q <= s;
end behavioral;