Vhdl 创建两个连接到一个mux 41和21的元素
我有一个大问题,因为我不能正确理解如何做作业。 嗯,我必须做这样的事情:Vhdl 创建两个连接到一个mux 41和21的元素,vhdl,intel-fpga,mux,Vhdl,Intel Fpga,Mux,我有一个大问题,因为我不能正确理解如何做作业。 嗯,我必须做这样的事情: 我有创建b1的代码,但我不知道如何创建第二个并使它们连接到b3 我的代码是: ieee库; 使用ieee.std_logic_1164.all; 实体测试是 一般的( n:整数:=4 ); 港口( a、 b,c,d:标准逻辑向量(n-1向下至0); s:标准逻辑向量(1到0); y:输出标准逻辑向量(n-1到0) ); 结束试验; --przypisanie sekwencyjne-案例 测试的架构arch_mux5为
我有创建b1的代码,但我不知道如何创建第二个并使它们连接到b3 我的代码是:
ieee库;
使用ieee.std_logic_1164.all;
实体测试是
一般的(
n:整数:=4
);
港口(
a、 b,c,d:标准逻辑向量(n-1向下至0);
s:标准逻辑向量(1到0);
y:输出标准逻辑向量(n-1到0)
);
结束试验;
--przypisanie sekwencyjne-案例
测试的架构arch_mux5为
开始
公共关系案例:过程(a、b、c、d、s)
开始
案例s是
当“00”=>y时,必须实例化这些多路复用器,例如:
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编译器),但这至少会引导您进入正确的方向。您必须实例化这些多路复用器,例如:
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编译器),但这至少会引导您进入正确的方向。是的,您的老师提供了两种实现同一mux的不同方法。这可能只是出于教育目的。您需要为b1和b2实例化此mux
正如@bmk指出的,您仍然需要为b3
提供一个实现,并在一个顶层实例化三个mux 是的,您的老师提供了两种不同的方法来实现相同的多路复用器。这可能只是出于教育目的。您需要为b1和b2实例化此mux
正如@bmk指出的,您仍然需要为b3
提供一个实现,并在一个顶层实例化三个mux