下面的代码不能正常工作。我不断地发现以下错误:
** Error: HA_Config.vhd(38): Component instance "HA_Inst : HA_Comp" not found. ** Error: HA_Config.vhd(40): VHDL Compiler exiting
library ieee;
use ieee.std_logic_1164.all;
entity HA_Entity is
port (
i_bit1 : in std_logic;
i_bit2 : in std_logic;
--
o_sum : out std_logic;
o_carry : out std_logic
);
end HA_Entity;
architecture HA_Arch of HA_Entity is
component HA_Comp is
port (
i_bit1 : in std_logic;
i_bit2 : in std_logic;
--
o_sum : out std_logic;
o_carry : out std_logic
);
end component HA_Comp;
begin
o_sum <= i_bit1 xor i_bit2;
o_carry <= i_bit1 and i_bit2;
end HA_Arch;
configuration HA_Config of HA_Entity is
for HA_Arch
for HA_Inst : HA_Comp
use entity HA_Entity(HA_Arch);
end for;
end for;
end HA_Config;发布于 2014-09-17 08:57:21
配置将组件实例绑定到特定的实体和体系结构。配置中的绑定部分是:
for HA_Inst : HA_Comp
use entity HA_Entity(HA_Arch);
end for;但是没有组件HA_Comp的组件实例名为HA_Comp,只在HA_Arch的体系结构部分中声明了一个组件HA_Comp,因此出现了错误:
组件实例"HA_Inst : HA_Comp“未找到。
HA_Comp实际上不在任何地方使用,所以可以删除它。而且,它看起来像一个循环引用,因为HA_Entity是为在configuration ... HA_Entity ... use entity HA_Entity ...内部使用而指定的。
如果目的是允许HA_Arch的不同实现,那么它可以如下所示:
library ieee;
use ieee.std_logic_1164.all;
entity HA_Entity is
port (
i_bit1 : in std_logic;
i_bit2 : in std_logic;
--
o_sum : out std_logic;
o_carry : out std_logic
);
end HA_Entity;
architecture HA_Arch of HA_Entity is
component HA_Comp is
port (
i_bit1 : in std_logic;
i_bit2 : in std_logic;
--
o_sum : out std_logic;
o_carry : out std_logic
);
end component HA_Comp;
begin
HA_Inst : component HA_Comp
port map(
i_bit1 => i_bit1,
i_bit2 => i_bit2,
o_sum => o_sum,
o_carry => o_carry);
end HA_Arch;
library ieee;
use ieee.std_logic_1164.all;
entity HA_Comp_Entity is
port (
i_bit1 : in std_logic;
i_bit2 : in std_logic;
--
o_sum : out std_logic;
o_carry : out std_logic
);
end HA_Comp_Entity;
architecture HA_Comp_Arch_1 of HA_Comp_Entity is
begin
o_sum <= i_bit1 xor i_bit2;
o_carry <= i_bit1 and i_bit2;
end HA_Comp_Arch_1;
use work.all;
configuration HA_Config of HA_Entity is
for HA_Arch
for HA_Inst : HA_Comp
use entity HA_Comp_Entity(HA_Comp_Arch_1);
end for;
end for;
end HA_Config;https://stackoverflow.com/questions/25878882
复制相似问题