【发布时间】:2020-03-22 17:13:32
【问题描述】:
我想为程序使用自定义输出端口。 我已经阅读了Can custom types be used in port declaration?,但它并没有解决我的问题。
在 my_package.vhd 中:
package my_package is
type custom_type is (a1,a2,a3,a4);
end package;
然后在我的 vhdl 程序中:
use work.my_package.all;
entity test is
port(testInt : out custom_type);
end entity test;
architecture test_a of test is
type custom_type is (a1,a2,a3,a4);
signal s: custom_type;
begin
testInt <= s;
end architecture;
但是,现在我有错误:
标识符“s”的类型与其作为“custom_type”类型的用法不一致
【问题讨论】:
-
IEEE Std 1076-2008 6.2 类型声明“通过详细说明不同类型定义创建的类型是不同类型。” 12.3 可见性 “如果内部区域包含该声明的同形异义词,则称该声明隐藏在(部分)内部声明区域内;然后,外部声明隐藏在内部同形异义词的直接范围内。” custom_type 的第二个声明隐藏了架构主体中的包声明(内部声明区域,use 子句出现在根声明区域中)。注释掉内部声明。
标签: vhdl