vhdl 中的并发过程调用
concurrent procedure call in vhdl
我试图理解使用不同参数的并发过程调用'class。假设我有程序测试并且它被同时调用如下:
ENTITY tb IS
END ENTITY tb;
ARCHITECTURE sim OF tb IS
SIGNAL cnt : integer RANGE 0 TO 3 := 0;
SIGNAL str : string(1 TO 5) := (OTHERS => ' ');
PROCEDURE test (CONSTANT number : IN integer RANGE 0 TO 3 := 0;
SIGNAL num_str : OUT string(1 TO 5)) IS
BEGIN
REPORT "here";
CASE number IS
WHEN 0 => num_str <= "zero ";
WHEN OTHERS => num_str <= "one ";
END CASE;
END PROCEDURE;
BEGIN
test(cnt, str); -- CONCURRENT CALL TO PROCEDURE TEST
PROCESS
BEGIN
FOR i IN 0 TO 3 LOOP
WAIT FOR 10 ns;
cnt <= i;
END LOOP;
WAIT;
END PROCESS;
END ARCHITECTURE sim;
在 VHDL 设计器指南中
Another point to note about concurrent procedure calls is that if there are no signals
associated with in-mode or inout-mode parameters, the wait statement in the equivalent
process does not have a sensitivity clause. If the procedure ever returns, the process suspends indefinitely. This may be useful if we want the procedure to be called only once at
startup time.
由于程序test没有与in-mode或inout-mode相关的信号,它应该被执行一次然后无限期挂起。但是对于这个例子,程序执行了 4 次。
有人可以向我解释发生了什么或我缺少什么吗?
2008 LRM(IEEE 标准 1076-2008)第 11.4 节:
For any concurrent procedure call statement, there is an equivalent
process statement [...] The equivalent process statement also has no
sensitivity list, an empty declarative part, and a statement part that
consists of a procedure call statement followed by a wait statement.
The procedure call statement consists of the same procedure name and
actual parameter part that appear in the concurrent procedure call
statement.
If there exists a name that denotes a signal in the actual part of any
association element in the concurrent procedure call statement, and
that actual is associated with a formal parameter of mode in or inout,
then the equivalent process statement includes a final wait statement
with a sensitivity clause that is constructed by taking the union of
the sets constructed by applying the rule of 10.2 to each actual part
associated with a formal parameter.
忘记最后一部分,在你的情况下事情非常简单,你的等效过程是:
process
begin
test(cnt, str);
wait on cnt;
end process;
您的过程声明的CONSTANT
class 声明仅表明(第 4.2.2.2 节):
For parameters of class constant or variable, only the values of the
actual or formal are transferred into or out of the subprogram call.
它以某种方式迫使您操纵这个值,就好像它是一个常量,没有别的……在过程的主体中。例如,它禁止您使用信号属性(例如 number'EVENT
)。但是它没有说明在实例化过程时将关联到此形式参数的实际参数。
从逻辑上讲,结果就是您所观察到的:您的过程在等效过程中被调用了 4 次。每次通过形参number
.
传递实参的值,即信号cnt
你的书是对的:
[...] if there are no signals associated with in-mode or inout-mode
parameters, the wait statement in the equivalent process does not have
a sensitivity clause.
确实,您有一个与 in-mode 参数 (number
) 关联的信号 (cnt
)。
我试图理解使用不同参数的并发过程调用'class。假设我有程序测试并且它被同时调用如下:
ENTITY tb IS
END ENTITY tb;
ARCHITECTURE sim OF tb IS
SIGNAL cnt : integer RANGE 0 TO 3 := 0;
SIGNAL str : string(1 TO 5) := (OTHERS => ' ');
PROCEDURE test (CONSTANT number : IN integer RANGE 0 TO 3 := 0;
SIGNAL num_str : OUT string(1 TO 5)) IS
BEGIN
REPORT "here";
CASE number IS
WHEN 0 => num_str <= "zero ";
WHEN OTHERS => num_str <= "one ";
END CASE;
END PROCEDURE;
BEGIN
test(cnt, str); -- CONCURRENT CALL TO PROCEDURE TEST
PROCESS
BEGIN
FOR i IN 0 TO 3 LOOP
WAIT FOR 10 ns;
cnt <= i;
END LOOP;
WAIT;
END PROCESS;
END ARCHITECTURE sim;
在 VHDL 设计器指南中
Another point to note about concurrent procedure calls is that if there are no signals associated with in-mode or inout-mode parameters, the wait statement in the equivalent process does not have a sensitivity clause. If the procedure ever returns, the process suspends indefinitely. This may be useful if we want the procedure to be called only once at startup time.
由于程序test没有与in-mode或inout-mode相关的信号,它应该被执行一次然后无限期挂起。但是对于这个例子,程序执行了 4 次。
有人可以向我解释发生了什么或我缺少什么吗?
2008 LRM(IEEE 标准 1076-2008)第 11.4 节:
For any concurrent procedure call statement, there is an equivalent process statement [...] The equivalent process statement also has no sensitivity list, an empty declarative part, and a statement part that consists of a procedure call statement followed by a wait statement. The procedure call statement consists of the same procedure name and actual parameter part that appear in the concurrent procedure call statement.
If there exists a name that denotes a signal in the actual part of any association element in the concurrent procedure call statement, and that actual is associated with a formal parameter of mode in or inout, then the equivalent process statement includes a final wait statement with a sensitivity clause that is constructed by taking the union of the sets constructed by applying the rule of 10.2 to each actual part associated with a formal parameter.
忘记最后一部分,在你的情况下事情非常简单,你的等效过程是:
process
begin
test(cnt, str);
wait on cnt;
end process;
您的过程声明的CONSTANT
class 声明仅表明(第 4.2.2.2 节):
For parameters of class constant or variable, only the values of the actual or formal are transferred into or out of the subprogram call.
它以某种方式迫使您操纵这个值,就好像它是一个常量,没有别的……在过程的主体中。例如,它禁止您使用信号属性(例如 number'EVENT
)。但是它没有说明在实例化过程时将关联到此形式参数的实际参数。
从逻辑上讲,结果就是您所观察到的:您的过程在等效过程中被调用了 4 次。每次通过形参number
.
cnt
你的书是对的:
[...] if there are no signals associated with in-mode or inout-mode parameters, the wait statement in the equivalent process does not have a sensitivity clause.
确实,您有一个与 in-mode 参数 (number
) 关联的信号 (cnt
)。