错误传递对VHDL中的函数的类型访问 [英] Error passing type access to function in VHDL
问题描述
我在VHDL中有一条包含指针(access
)的记录.
我需要创建一个函数来接收该记录作为参数,并从其数据写入文件中.
I have a record in VHDL that contains a pointer (access
).
I need to create a function that receives this record as parameter and from its data write in a file.
但是用MODELSIM模拟时,出现以下错误:
But simulating with MODELSIM I get the following error:
**错误:(vcom-1462)非法声明了类型为x_file_format(类型为或包含访问类型)的常量"xxx".
**Error: (vcom-1462) Illegal declaration of constant "xxx" of type x_file_format (type is or contains access type).
如何将指针作为参数传递给函数?
How can I pass a pointer as parameter to a function?
推荐答案
功能参数只能是常量(或信号或文件)输入.访问类型必须是变量.因此,您必须编写一个过程来完成该过程,并将访问类型作为变量传入.
Function parameters can only be constant (or signal or file) inputs. Access types must be variables. Therefore you must write a procedure to do it, with the access type passed in as a variable.
Procedure proc ( variable ptr : someAccessType ) is
这篇关于错误传递对VHDL中的函数的类型访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!