【问题标题】:"Warning C0007 : Architecture has unbound instances" issue!“警告 C0007:架构有未绑定的实例”问题!
【发布时间】:2011-05-27 11:26:54
【问题描述】:

我从“数字设计基础”一书随附的 CD 中获得了以下源代码。

当我尝试运行程序时,它给了我以下错误:

Compiling Fig17_13.vhd...
C:\Users\SPIDER\Desktop\EE460\The Final Project\Fig17_13.vhd(25): Warning C0007 : Architecture has unbound instances (ex. ct2)
Done

我该如何解决这个问题?

代码如下:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity c74163test is
    port(ClrN,LdN,P,T1,Clk: in std_logic;
       Din1, Din2: in std_logic_vector(3 downto 0);
       Count: out integer range 0 to 255;
       Carry2: out std_logic);
end c74163test;

architecture tester of c74163test is
    component c74163
       port(LdN, ClrN, P, T, Clk : in std_logic;  
         D: in std_logic_vector(3 downto 0);
       Cout: out std_logic; Qout: out std_logic_vector(3 downto 0) );
    end component;
    signal Carry1: std_logic;
    signal Qout1, Qout2: std_logic_vector(3 downto 0);
begin
    ct1: c74163 port map (LdN,ClrN,P,T1,Clk,Din1,Carry1, Qout1);
    ct2: c74163 port map (LdN,ClrN,P,Carry1,Clk,Din2,Carry2,Qout2);
    Count <= Conv_integer(Qout2 & Qout1);
end tester;

【问题讨论】:

    标签: counter vhdl digital-design


    【解决方案1】:

    你之前真的读过实例化的设计吗(我猜它在Fig17_12.vhd)?否则你的实例只是一个黑盒(我猜是“未绑定实例”的意思)。

    【讨论】:

      【解决方案2】:

      将 VHDL 组件想象成一个塑料芯片插座。将实体想象成插入其中的芯片。您的代码中的实例是组件:将您的代码想象成一个 PCB(您的架构),上面焊接了一些塑料插座(组件)。你需要筹码(entities)。

      芯片是如何进入插槽的?或者,更正式地说,实体如何绑定到组件。好吧,(i)如果它们的名称相同,那么 binding 会自动发生(但如果端口不同,详细说明将失败)。如果名称不同(或端口不同),则需要编写 VHDL 配置 以将实体与组件匹配。

      所以,在你的情况下,你要么

      (i) 尚未编译实体c74163

      (ii) 已经这样做了,但是实体c74163 与组件c74163 不同,即:

      entity c74163
         port(LdN, ClrN, P, T, Clk : in std_logic;  
           D: in std_logic_vector(3 downto 0);
         Cout: out std_logic; Qout: out std_logic_vector(3 downto 0) );
      end entity;
      

      你应该问问自己是否真的需要使用组件实例化。组件实例化是 VHDL-93 之前的唯一实例化类型,但从那时起,您还可以选择使用直接实例化,您只需实例化实体而不使用组件。将直接实例化视为直接将芯片焊接到 PCB 上;不涉及塑料插座。

      直接实例化通常是正确的选择:它更容易,而且您不必费心将所有内容写两次(在实体和组件中)。缺点是您现在必须确保在实例化它的任何架构之前编译实体。

      这是您使用直接实例化编写的代码:

      library IEEE;
      use IEEE.STD_LOGIC_1164.ALL;
      use IEEE.STD_LOGIC_ARITH.ALL;
      use IEEE.STD_LOGIC_UNSIGNED.ALL;
      
      entity c74163test is
          port(ClrN,LdN,P,T1,Clk: in std_logic;
             Din1, Din2: in std_logic_vector(3 downto 0);
             Count: out integer range 0 to 255;
             Carry2: out std_logic);
      end c74163test;
      
      architecture tester of c74163test is
          signal Carry1: std_logic;
          signal Qout1, Qout2: std_logic_vector(3 downto 0);
      begin
          ct1: entity work.c74163 port map (LdN,ClrN,P,T1,Clk,Din1,Carry1, Qout1);
          ct2: entity work.c74163 port map (LdN,ClrN,P,Carry1,Clk,Din2,Carry2,Qout2);
          Count <= Conv_integer(Qout2 & Qout1);
      end tester;
      

      【讨论】:

      • 默认绑定指示仅取决于实体和组件匹配的简单名称。请参阅 IEEE Std 1076-2008 7.3 配置规范(可以是隐式的)和 7.3.3 默认绑定指示。如果端口类型不匹配而不是警告您的组件未绑定,您会期望出现详细说明错误。 small example 可以展示的东西。
      猜你喜欢
      • 1970-01-01
      • 2011-08-15
      • 1970-01-01
      • 1970-01-01
      • 2021-12-06
      • 1970-01-01
      • 2020-02-03
      • 2011-12-21
      • 2018-07-07
      相关资源
      最近更新 更多