在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 4073|回复: 1

【新手求助】vhdl小程序

[复制链接]
发表于 2009-8-7 09:42:10 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
程序如下:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY half_adder IS
PORT(dataA, dataB: IN STD_LOGIC;
     sum: OUT STD_LOGIC;
     carry: OUT STD_LOGIC
);
END ENTITY half_adder ;
ARCHITECTURE dataflow OF half_adder IS
BEGIN
sum <= dataA XOR dataB;
carry <= dataA AND dataB;
END ARCHITECTURE dataflow;

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY full_adder IS
PORT(dataA, dataB, carryin: IN STD_LOGIC;
     sum:OUT STD_LOGIC;
     carryout:OUT STD_LOGIC
);
END ENTITY full_adder;
ARCHITECTURE struct OF full_adder IS
COMPONENT half_adder
PORT(a,b : IN STD_LOGIC;
     s: OUT STD_LOGIC;
     ca: OUT STD_LOGIC
);
END COMPONENT;
SIGNAL u1sum, u1carry, u2carry : STD_LOGIC;
BEGIN
u1: half_adder PORT MAP(dataA, dataB, u1sum, u1carry);
u2: half_adder PORT MAP(u1sum, carryin,sum, u2carry);
carryout<= u2carry OR u1carry;
END ARCHITECTURE struct;

软件版本是:QUARTUS II 7.2
编译时报错:
Error: Port "a" does not exist in macrofunction "u2"
Error: Port "b" does not exist in macrofunction "u2"
Error: Port "ca" does not exist in macrofunction "u2"
Error: Port "s" does not exist in macrofunction "u2"
Error: Port "a" does not exist in macrofunction "u1"
Error: Port "b" does not exist in macrofunction "u1"
Error: Port "ca" does not exist in macrofunction "u1"
Error: Port "s" does not exist in macrofunction "u1"
Error: Quartus II Analysis & Synthesis was unsuccessful. 8 errors, 0 warnings
Info: Allocated 154 megabytes of memory during processing
Error: Processing ended: Fri Aug 07 09:04:14 2009
Error: Elapsed time: 00:00:01


路过的大狭帮帮忙吧,万分感谢!
发表于 2009-8-9 23:58:27 | 显示全部楼层

路过!

已经确定是你元件例化声明、例化的问题。
half_adder定义部分和full_adder中half_adder的元件声明部分端口port 命名不一致。改成一样的就可以了!
比如把half_adder部分改成如下:(只改了端口声明部分)
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY half_adder IS
PORT(a, b: IN STD_LOGIC;
     s: OUT STD_LOGIC;
     ca: OUT STD_LOGIC
);
END ENTITY half_adder ;
ARCHITECTURE dataflow OF half_adder IS
BEGIN
s <= a XOR b;
ca <= a AND b;
END ARCHITECTURE dataflow;

建议:元件例化的时候还是用名字映射的方法吧,很多书建议这个习惯的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-22 16:44 , Processed in 0.015754 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表