让我们说我只有2输入XOR以下的实体来创建一个4输入XOR。
entity exclusive_or is
port(A,B: in BIT; S: out BIT);
end exclusive_or;
我知道我必须宣布一些信号,但不知道如何。
答案 0 :(得分:3)
entity exclusive_or_4 is port(
A,B,C,D: in BIT;
S: out BIT
);
end entity;
architecture rtl of exclusive_or_4 is
signal output : bit_vector(1 downto 0);
begin
U0: component exclusive_or port map (
A => A,
B => B,
S => output(0)
);
U1: component exclusive_or port map (
A => C,
B => D,
S => output(1)
);
U2: component exclusive_or port map(
A => output(0),
B => output(1),
S => S
);
end architecture;