I tried to do this
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux_8to1 is
Port ( Y : in STD_LOGIC_VECTOR (0 to 7);
S : in STD_LOGIC_VECTOR (2 downto 0);
F : out STD_LOGIC);
end mux_8to1;
architecture Behavioral of mux_8to1 is
begin
run: for i in 0 to 7 generate
F <= Y(i) when S = i else
'0';
end generate run;
end Behavioral;
but the Xilinx report an error to me
ERROR:Xst:528 - Multi-source in Unit <mux_8to1> on signal <F>
Is that the index can't be used in the input or somewhere?