忽略返回值 procedure/function VHDL

ignore returned value procedure/function VHDL

我在 VHDL 包中有几个函数和过程。 我想问问有没有办法忽略这些out项目。 我知道端口映射的 open 关键字。 我正在使用分配给程序的虚拟信号。但这可能是更有效的方法。

¿VHDL 有这样的东西吗? 如果我将输出信号设置为打开,则会出现以下错误: "Formal e5 of mode out must have an associated actual"

提前致谢, 安东尼奥

已编辑:代码

procedure reg2ind
 (signal reg : in std_logic_vector(15 downto 0);
  signal e1,e2,e3,e4,e5,e6,e7,e8 : out std_logic;
  signal e9,e10,e11,e12,e13,e14,e15,e16 : out std_logic) is 
begin
  e1 <= reg(0);
  e2 <= reg(1);      
  e3 <= reg(2);
  e4 <= reg(3);
  e5 <= reg(4);
  e6 <= reg(5);
  e7 <= reg(6);
  e8 <= reg(7);
  e9 <= reg(8);
  e10 <= reg(9);
  e11 <= reg(10);
  e12 <= reg(11);
  e13 <= reg(12);
  e14 <= reg(13);
  e15 <= reg(14);
  e16 <= reg(15);
end reg2ind;

我用的时候:

reg2ind(val183,ord_p.err.err_17,ord_p.err.err_18,
ord_p.err.err_19,ord_p.err.err_20,open,open,open,open,open,open,
open,open,open,open, open,open);

缺少 MCVE 对于理解分析错误并不重要。

参见 IEEE Std 107-2008,10.7 过程调用语句,第 4 段:

For each formal parameter of a procedure, a procedure call shall specify exactly one corresponding actual parameter. This actual parameter is specified either explicitly, by an association element (other than the actual open) in the association list or, in the absence of such an association element, by a default expression (see 6.5.2).

参见 4.2 子程序声明,4.2.2.3 信号参数第 1 段:

For a formal parameter of class signal, references to the signal, the driver of the signal, or both, are passed into the subprogram call.

和第 6 段:

If an actual signal is associated with a signal parameter of any mode, the actual shall be denoted by a static signal name. It is an error if a conversion function or type conversion appears in either the formal part or the actual part of an association element that associates an actual signal with a formal signal parameter.

另见 14.6 动态阐述,第 2 段,b)(部分):

Execution of a subprogram call involves the elaboration of the parameter association list. ...

动态阐述与 open 不兼容,它删除了对同一过程的其他调用可能需要的驱动程序。

因此,如 4.2 子程序声明、4.2.2.3 信号参数第 6 段所示的规则要求实际为静态信号名称。

这个特定的过程示例很乏味,只是将数组输入的元素分配给信号输出。

一个 MCVE:

library ieee;
use ieee.std_logic_1164.all;

entity foo is
end entity;

architecture fum of foo is   
    procedure reg2ind
     (signal reg : in std_logic_vector(15 downto 0);
      signal e1,e2,e3,e4,e5,e6,e7,e8 : out std_logic;
      signal e9,e10,e11,e12,e13,e14,e15,e16 : out std_logic) is 
    begin
      e1 <= reg(0);
      e2 <= reg(1);      
      e3 <= reg(2);
      e4 <= reg(3);
      e5 <= reg(4);
      e6 <= reg(5);
      e7 <= reg(6);
      e8 <= reg(7);
      e9 <= reg(8);
      e10 <= reg(9);
      e11 <= reg(10);
      e12 <= reg(11);
      e13 <= reg(12);
      e14 <= reg(13);
      e15 <= reg(14);
      e16 <= reg(15);
    end procedure reg2ind;

    signal val183:  std_logic_vector (15 downto 0);
    type err_record is
        record
            err_17: std_logic;
            err_18: std_logic;
            err_19: std_logic;
            err_20: std_logic;
        end record;
    type some_record is 
        record
        err: err_record;
        end record;

    signal ord_p: some_record;

    signal open5, open6, open7,
           open8, open9, open10,
           open11, open12, open13,
           open14, open15, open16:      std_logic;
begin

    reg2ind(val183,ord_p.err.err_17,ord_p.err.err_18,
    ord_p.err.err_19,ord_p.err.err_20,open5,open6,open7,open8,open5,open6,
    open7,open8,open9,open10, open11,open12);  -- with dummy outputs

    -- reg2ind(val183,ord_p.err.err_17,ord_p.err.err_18,
    -- ord_p.err.err_19,ord_p.err.err_20,open,open,open,open,open,open,
    -- open,open,open,open, open,open);  -- as presented  FAILS


end architecture;

感兴趣的 reader 可以探索使用基于信号的参数的局限性。

最简单的解决方案可能是使用聚合赋值目标,其中的元素重新排列以匹配实际的顺序,而不是过程调用:

    (ord_p.err.err_20, ord_p.err.err_19, ord_p.err.err_18, ord_p.err.err_17) <=
        val183(3 downto 0);

重新排列目标允许右侧成为切片名称,而不是也需要限定表达式的聚合。这比过程调用的文本复杂性要低。

任何通过使用过程调用来隐藏细节的动力都可以伴随提供具有更少参数的过程。

函数调用是表达式,在语义上不可能忽略它们的结果值。您可以在条件执行语句(例​​如 if 语句、case 语句)中包含包含函数调用或过程调用语句的语句。