Altera_Forum
Honored Contributor
9 years agoImplement mux using for loop
Hi
I think it is possible to implement a mux using a for loop like in the following example:
type array_type is array (7 downto 0) of std_logic_vector(15 downto 0);
signal mux_in: array_type;
signal mux_slct: unsigned(2 downto 0);
signal mux_out: std_logic_vector(15 downto 0);
...
p_mux : process(mux_slct,mux_in)
begin
mux_out <= (others=>'0');
for i in 0 to 7 loop
if i=mux_slct then
mux_out <= mux_in(i);
end if;
end loop;
end process p_mux;
My problem is that Quartus seems (based on RTL viewer) to synthesise it as a priority circuit which is not efficient at all. Does anyone knows if: -> something is missing in my code? -> Quartus doesn't support this construction? -> Some config of the synthesis tool could solve this? I'm using Quartus II 32-bit Version 12.1 Build 243 01/31/2013 SJ Web Edition Thanks in advance, Jean