2013-10-06 14 views
5

據我所知,一個PROCESS中的所有語句都是按順序執行的。那麼併發信號分配會發生什麼(< =)?它與順序賦值(:=)的工作方式相同嗎?還是在增量延遲後執行?流程語句中的(併發)信號分配是順序的還是併發的?

如果它在delta延遲後執行,那麼Process中的所有語句如何被順序調用?

如果它立即執行,那麼在過程中= =和< =是否有區別?

回答

7

信號分配(< =)在過程中的所有順序代碼完成執行後執行。這是當該時間步的所有活動進程完成時。

作爲一個例子,爲什麼是這樣的:

假設你有觸發2個進程的事件。這兩個進程 使用相同的信號,但其中一個進程更改該信號的值。由於順序模擬模型(不要與vhdl的 併發模型混淆),仿真器只能在 時間執行一個過程。因此,如果首先模擬過程A並且A 改變信號,則B將具有錯誤的信號值。因此, 信號只能在所有觸發的過程完成後才能更改。

變量賦值(:=)執行得很靈活,可用於例如在進程中臨時存儲一些數據。

3

順序信號分配(< =)與順序變量分配(:=)相對,順序調度一個事件一個delta延遲,以便更新信號的值。您可以通過在同一過程中使用同一信號上的順序信號分配來更改預定事件。只有在特定信號上安排的最後更新纔會發生。例如:

signal a : std_logic := '1'; --initial value is 1 

process(clk) 
    variable b : std_logic; 
begin 
    --note that the variable assignment operator, :=, can only be used to assign the value of variables, never signals 
    --Likewise, the signal assignment operator, <=, can only be used to assign the value of signals. 
    if (clk'event and clk='1') then 
    b := '0' --b is made '0' right now. 
    a <= b; --a will be made the current value of b ('0') at time t+delta 
    a <= '0'; --a will be made '0' at time t+delta (overwrites previous event scheduling for a) 
    b := '1' --b will be made '1' right now. Any future uses of b will be equivalent to replacing b with '1' 
    a <= b; --a will be made the current value of b ('1') at time t+delta 
    a <= not(a); --at time t+delta, a will be inverted. None of the previous assignments to a matter, their scheduled event have been overwritten 
    --after the end of the process, b does not matter because it cannot be used outside of the process, and gets reset at the start of the process 
    end if; 
end process; 

同樣重要的是要注意,雖然順序工藝從在VHDL邏輯透視操作順序,合成時,它們實際上變成連接觸發器複雜併發語句。整個過程作爲一個單元在每個時鐘週期之間同時運行(不在時鐘上運行的過程變成純粹的組合邏輯)。信號是實際存儲在觸發器中的值。變量只是讓別人更容易閱讀的別名。合成後它們被吸收到組合邏輯中。

相關問題