library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity SetResetHold is
Port (
        clk         :IN     STD_LOGIC;
        Set         :IN     STD_LOGIC;
        Reset       :IN     STD_LOGIC;
        Result      :OUT    STD_LOGIC := '1'
);
end SetResetHold;

architecture Behavioral of SetResetHold is


signal hasResetSeen : STD_LOGIC := '0';

begin
proc: process(clk)
begin
    if(rising_edge(clk)) then
        if(Set = '0') then
            Result <= '0';
            hasResetSeen <= '0';
        elsif (Reset = '1' and hasResetSeen = '1') then
            Result <= '1';
        end if;
        
        if (Reset = '0') then
            hasResetSeen <= '1';
        end if;
    end if;
    
end process;
end Behavioral;
