如何解决“警告C0007:体系结构具有未绑定的实例”问题!
| 我从《数字设计基础》一书附带的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,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,Clk,Din1,Carry1,Qout1);
ct2: c74163 port map (LdN,Din2,Carry2,Qout2);
Count <= Conv_integer(Qout2 & Qout1);
end tester;
解决方法
您之前确实读过实例化的设计吗(我猜它在
Fig17_12.vhd
中)?否则,您的实例只是一个黑盒(我想这是“未绑定实例”的意思)。
, 可以将VHDL组件想像成塑料芯片插座。可以将实体视为插入其中的芯片。代码中的实例是组件的:将您的代码看作是一块PCB(您的体系结构),上面焊接有一些塑料插座(这些组件)。您需要筹码(实体)。
芯片如何进入插槽?或者,更正式地说,实体如何绑定到组件。好吧,(i)如果它们的名称相同,则绑定会自动发生(但如果端口不同,则说明将失败)。如果名称不同(或端口不同),则需要编写VHDL配置以使实体与组件匹配。
因此,就您而言,您要么
(i)尚未汇编实体“ 3”或
(ii)已这样做,但实体“ 3”与组件“ 3”并不相同,即:
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,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,Clk,Din1,Carry1,Qout1);
ct2: entity work.c74163 port map (LdN,Din2,Carry2,Qout2);
Count <= Conv_integer(Qout2 & Qout1);
end tester;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。