Guest
Hello everybody,
I want to make generic multiplexer. I am using FOR/GENERATE to make
multiple code lines and conditional generate to make last line
(without ELSE). Please, suggest what to do and why my code doesn't
work. Thank you in advance.
----------------------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity gen_mux1 is
generic(n: integer:=3);
port (input : in std_logic_vector(2**n-1 downto 0);
sell : in std_logic_vector(n-1 downto 0);
output: out std_logic);
end gen_mux1;
architecture Behavioral of gen_mux1 is
begin
a: FOR i IN 0 TO 2**n-1 GENERATE
b1: IF i /= 2**n-1 GENERATE
output <= input(i) WHEN i = conv_integer(sel) ELSE
END GENERATE;
b2: IF i = 2**n-1 GENERATE
output <= input(i) WHEN OTHERS
END GENERATE;
END GENERATE;
end Behavioral;
-----------------------------------------------------------------------------------------------------------------
P.S. I want code to be concurrent.
I want to make generic multiplexer. I am using FOR/GENERATE to make
multiple code lines and conditional generate to make last line
(without ELSE). Please, suggest what to do and why my code doesn't
work. Thank you in advance.
----------------------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity gen_mux1 is
generic(n: integer:=3);
port (input : in std_logic_vector(2**n-1 downto 0);
sell : in std_logic_vector(n-1 downto 0);
output: out std_logic);
end gen_mux1;
architecture Behavioral of gen_mux1 is
begin
a: FOR i IN 0 TO 2**n-1 GENERATE
b1: IF i /= 2**n-1 GENERATE
output <= input(i) WHEN i = conv_integer(sel) ELSE
END GENERATE;
b2: IF i = 2**n-1 GENERATE
output <= input(i) WHEN OTHERS
END GENERATE;
END GENERATE;
end Behavioral;
-----------------------------------------------------------------------------------------------------------------
P.S. I want code to be concurrent.