5

据我了解, PROCESS 中的所有语句都是按顺序执行的。那么并发信号分配(<=)会发生什么?它的工作方式与顺序分配(:=)相同还是在增量延迟后执行?

如果它在 delta 延迟之后执行,那么 PROCESS 中的所有语句如何被称为顺序?

如果它立即执行,那么进程中 := 和 <= 之间有什么区别吗?

4

2 回答 2

7

信号分配 (<=) 是在进程中的所有顺序代码执行完毕后执行的。这是该时间步的所有活动进程都完成的时间。

例如,为什么会这样:

假设您有一个触发 2 个进程的事件。这 2 个进程使用相同的信号,但其中一个会更改该信号的值。由于顺序仿真模型,模拟器一次只能执行一个进程(不要与 vhdl 的并发模型混淆)。因此,如果首先模拟过程 A 并且 A 更改信号,则 B 将具有错误的信号值。因此,只有在所有触发过程完成后才能更改信号。

变量赋值 (:=) 立即执行并可用于例如在进程内临时存储一些数据。

于 2013-10-06T14:17:04.367 回答
4

顺序信号分配 (<=) 与顺序变量分配 (:=) 不同,它顺序地安排一个事件延迟一个增量延迟,以便更新信号的值。您可以通过对同一进程中的同一信号使用顺序信号分配来更改计划事件。只有在特定信号上安排的最后一次更新才会发生。例如:

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 中从逻辑角度顺序操作,但在综合时,它们实际上变成了连接触发器的复杂并发语句。整个过程在每个时钟周期之间作为一个单元同时运行(不在时钟上运行的过程成为纯粹的组合逻辑)。信号是实际存储在触发器中的值。变量只是为了使过程更易于阅读而使用别名。它们在综合后被吸收到组合逻辑中。

于 2013-10-07T21:10:53.007 回答