P_dec1_update:process(presentstate,rst)
begin
if rst='1' then p_dec1<="11111111";
elsif (presentstate="010" or presentstate="011" or presentstate="100") then
if P_enc="000" then p_dec1<="00000000";
elsif P_enc="001" then p_dec1<="00000001";
elsif P_enc="010" then p_dec1<="00000011";
elsif P_enc="011" then p_dec1<="00000111";
elsif P_enc="100" then p_dec1<="00001111";
elsif P_enc="101" then p_dec1<="00011111";
elsif P_enc="110" then p_dec1<="00111111";
elsif P_enc="111" then p_dec1<="01111111";
else p_dec1<="XXXXXXXX";
END IF;
else p_dec1<="11111111";
end if;
end process p_dec1_update;