首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VHDL配置找不到组件

VHDL配置找不到组件
EN

Stack Overflow用户
提问于 2014-09-16 21:41:27
回答 1查看 1.4K关注 0票数 0

下面的代码不能正常工作。我不断地发现以下错误:

** Error: HA_Config.vhd(38): Component instance "HA_Inst : HA_Comp" not found. ** Error: HA_Config.vhd(40): VHDL Compiler exiting

代码语言:javascript
复制
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;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-17 08:57:21

配置将组件实例绑定到特定的实体和体系结构。配置中的绑定部分是:

代码语言:javascript
复制
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的不同实现,那么它可以如下所示:

代码语言:javascript
复制
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;
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25878882

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档