VHDL函数是否必须返回值?

时间:2018-12-05 15:31:55

标签: vhdl

我想创建一个通过TEXTIO库写入文件的函数。自然地写,这是一个非常简单的例程,但是为了清楚起见,我宁愿将其编写为一个函数。

我知道编写函数的典型方法如下

标题类型...

function my_func(my_arg : my_arg_type) return return_type;

身体类型...

function my_func(my_arg : my_arg_type) return return_type is

但是,如果我对返回任何东西都不感兴趣,有办法避免严重警告-

return type is not specified

问候,

2 个答案:

答案 0 :(得分:3)

不。但是,您可以改用过程

procedure my_func (my_arg : my_arg_type) is

您可以将过程放入包装中

package P is
  procedure my_func (my_arg : my_arg_type);
end package P;

package body P is
  procedure my_func (my_arg : my_arg_type) is
  begin
    // blah blah blah
  end procedure my_func;
end package body P;

SystemVerilog具有 void函数,它们没有返回类型,但这不能使用VHDL来完成。

答案 1 :(得分:2)

不。函数必须始终返回已知类型的值。 您应该改用一个过程。

相关问题