Вы должны создать экземпляры этих мультиплексоров, например ::10000
entity top is
generic (
n: integer:=4
);
port (
a, b, c, d, e, f, g, h: in std_logic_vector(n-1 downto 0);
s: in std_logic_vector(2 downto 0);
y: out std_logic_vector(n-1 downto 0)
);
end entity top;
architecture struct of top is
signal t1, t2: std_logic_vector(n-1 downto 0);
component test is
generic(
n : integer := 4
);
port (
a, b, c, d : in std_logic_vector(n-1 downto 0);
s : in std_logic_vector(1 downto 0);
y : out std_logic_vector(n-1 downto 0)
);
end component test;
component mux2 is
generic(
n : integer := 4
);
port (
a, b : in std_logic_vector(n-1 downto 0);
s : in std_logic;
y : out std_logic_vector(n-1 downto 0)
);
end component test;
begin
b1: test
generic_map (
n => n
);
port map (
a => a,
b => b,
c => c,
d => d,
s => s(1 downto 0),
y => t1
);
b2: test
generic_map (
n => n
);
port map (
e => a,
f => b,
g => c,
h => d,
s => s(1 downto 0),
y => t2
);
b3: mux2
generic_map (
n => n
);
port map (
a => t1,
b => t2,
s => s(2),
y => y
);
end architecture struct;
Конечно, вы все равно должны написать сущность + архитектура для mux2
. Я не тестировал этот код (здесь у меня нет компилятора VHDL), но это должно, по крайней мере, привести вас в правильном направлении.