我正在尝试通过生成n个基本fulladder(代码中为ALCell)单元来制作n位加法器。因此,如图所示,我制作了代码,但没有合成其中的3个(如我所拥有的),但是我得到的一个单元格的信号连接方式错误。如果我将输出信号oRes和oCarry更改为: oRes <= sFnc(cell_num -1); oCarry <= sCarry(cell_num -1); 那么将生成两个带有一些警告的单元(sCarry(3)和sRes(3)在设计中的任何位置均未连接)。 您能帮我看看为什么从编写的代码中我不想要设计吗。 Thx,Nebojsa
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mul_cell is
generic ( cell_num : integer := 3 );
port ( iL : in std_logic_vector(cell_num-1 downto 0);
iCarry : in std_logic;
oRes : out std_logic;
oCarry : out std_logic );
end mul_cell;
architecture Behavioral of mul_cell is
component ALCell
port( iA : in std_logic;
iB : in std_logic;
iC : in std_logic;
oFnc : out std_logic;
oC : out std_logic );
end component;
signal sL : std_logic_vector(cell_num-1 downto 0);
signal sCarry: std_logic_vector(cell_num downto 0);
signal sFnc : std_logic_vector(cell_num downto 0);
begin
sL <= iL;
sFnc(0) <= '0';
sCarry(0) <= iCarry;
GEN_ADD_Level_3:
for I in 1 to cell_num generate
ADDX : ALCell
port map(iA => sL(I-1),
iB => sFnc(I-1),
iC => sCarry(I-1),
oFnc => sFnc(I),
oC => sCarry(I) );
end generate GEN_ADD_Level_3;
oRes <= sFnc(cell_num);
oCarry <= sCarry(cell_num);
end Behavioral;