假设我下面只有一个2输入异或的实体来创建一个4输入异或。
entity exclusive_or is
port(A,B: in BIT; S: out BIT);
end exclusive_or;我知道我要宣布一些信号,但不知道怎么做。
发布于 2014-10-07 15:55:04
首先,让我们在纸上画出我们想要做的事情:

然后,我们将其转换为VHDL:
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;https://stackoverflow.com/questions/26239689
复制相似问题