簡體   English   中英

為什么在模擬開始時執行此過程

[英]Why this process is executed when the simulation starts

這是一個簡單的實體,只是為了了解“進程”的用法

我的問題是:為什么在模擬剛開始時執行該過程? 我認為當靈敏度列表中的信號發生變化時該過程會喚醒,但在此示例中,分配給信號“a”的時間是在模擬開始后 3ns。

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;  
use ieee.numeric_std.all;         
use ieee.math_real.all;           

entity test4 is
    port (
        a : in bit;
        f : out bit
    );

end test4;

architecture test4_arc of test4 is
    signal b : bit;
begin

    process(a)
    begin
        report "process triggered";
        
        b <= a;
        f <= not a;
    end process;

end test4_arc;

這是測試台

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;
use ieee.std_logic_textio.all;
-----------------------------------------------------------
entity test4tb is
end entity ;
-----------------------------------------------------------
architecture testbench of test4tb  is

   component test4
    port (
        a : in bit;
        f : out bit
    );
   end component;

signal atest,ftest : bit;

begin
    -----------------------------------------------------------
    process
    begin
        wait for 3ns;
        atest <= '0';
        wait for 5ns;
        atest <= '1';
        wait for 5ns;
    end process ;

    dut : test4 port map (
        a => atest,
        f => ftest
    );

end architecture testbench;

來自 Modelsim 控制台的消息

# ** Note: process triggered
#    Time: 0 ns  Iteration: 0  Instance: /test4tb/dut
# ** Note: process triggered
#    Time: 8 ns  Iteration: 1  Instance: /test4tb/dut
# ** Note: process triggered
#    Time: 16 ns  Iteration: 1  Instance: /test4tb/dut
# ** Note: process triggered

在此處輸入圖像描述

所有進程將在時間 0 處至少執行一次。假設具有敏感度列表的process wait on <list>作為進程中的最后一條語句。 您可以在VHDL LRM 第 11.3 節流程聲明中閱讀此內容:

如果在保留字 process 之后出現進程敏感度列表,則假定進程語句包含隱式等待語句作為進程語句部分的最后一條語句; 這個隱式等待語句的形式是

wait on sensitivity_list;

在 LRM 第14.7.5.2 節初始化中進一步:

f) 對於 model 中的每個非延遲進程 P,以下操作按指示的順序發生: 1) 進程執行直到暫停。

因此,所有進程將一直運行,直到它們在模擬的第一個增量周期中首次掛起。 因為進程實際上是無限循環,所以它們必須從某個地方開始。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM