entity SelectorWithHiZ_using_For_Loop is
generic (
candidates_num : integer := 8);
port (
candidates : in std_logic_vector(candidates_num - 1 downto 0);
selects : in std_logic_vector(candidates_num - 1 downto 0);
result : out std_logic);
end SelectorWithHiZ_using_For_Loop;
architecture Behavioral of SelectorWithHiZ_using_For_Loop is
begin
process(selects)
variable tmp : std_logic;
begin
tmp := 'Z';
for i in selects'high downto selects'low loop
if selects(i) = '1' then
tmp := candidates(i);
end if;
end loop;
result <= tmp;
end process;
end Behavioral;