【发布时间】:2018-12-17 11:18:24
【问题描述】:
我有一个函数调用来简化信号转换,否则会在整个源代码中重复。
现在,作为进一步的优化,我想使用别名使相当复杂的函数调用(两个参数几乎相同)更具可读性和更易于编写。
'87 之后的 VHDL 标准允许为非数据对象使用别名,例如子程序调用。在寻找解决方案时,我了解到函数需要签名作为别名声明的一部分。然而,我找不到帮助我为与 Synopsys VCS 一起使用的函数声明别名的文档。
function discard_elem (
signal discard_vector : in std_ulogic_vector(63 downto 0);
signal id : in std_ulogic_vector(5 downto 0))
return std_ulogic is
begin
return discard_vector(to_integer(unsigned(id)));
end discard_elem;
alias discard_current_elem is
discard_elem(discard_vector_i, interface_i.id) [ return std_ulogic ];
VCS 报告以下错误,然后以分段错误退出:
Error-[ANL-ALIAS-BADSIGNAT] Bad signature in alias declaration
^
No subprogram or enumeration literal matches the signature of the alias
declaration DISCARD_ELEM.
Please verify that the signature matches the parameter and result type
profile of exactly one of the subprograms or enumeration literals.
是别名定义错误还是工具问题?
【问题讨论】:
-
IEEE Std 1076-2008 6.6.3 非对象别名“以下规则适用于非对象别名:,,,"b) 如果名称表示子程序(包括运算符)或枚举,则需要签名文字。在这种情况下,签名需要匹配(参见 4.5.3)名称所表示的子程序或枚举文字之一的参数和结果类型配置文件。” VCS 找不到带有签名类型标记的声明函数 discard_elem (4.5.3 签名)discard_vector_i 和 interface_i.id。子程序不是“非数据对象”(6.4 对象),它是命名实体(6.1)。