concurrent and sequential statements in VHDL

微笑、不失礼 提交于 2021-02-11 14:49:52

问题


I have a fundamental question on VHDL.

Consider the following process:

process(Clk)
begin
if(rising_edge(Clk)) then
  a <= data_in;
  b <= a;
  c <= b;
  data_out <= c;
end if;
end process;

The above process acts as a delay register, where data_in is output to data_out after 4 clock cycles.

From my understanding this happens because signals are assigned parallelly. But then why does the statements inside a process called sequential?

For example:

process(Clk)
begin
if(rising_edge(Clk)) then
  a <= b or c;
  a <= b and c;
end if;
end process;

In the above process the 'a' takes the value from the 2nd statement and I understand, how it works in a sequential way unlike the first process.

Please help.


回答1:


It's actually very simple: all statements inside a VHDL process are executed sequentially, in order, from top to bottom, no exceptions. However,

  1. the left hand side of a signal assignment operator (<=) does not take its new value until the process (and all other processes) have suspended (either hit the bottom or hit a wait statement) and

  2. if you assign to a signal again (as in your second example) the last assignment executed overwrites the previous ones.

Now you know that, simulate the above two processes in your head and you will see that they behave as you say they will. (The statements in your first example are NOT executed in parallel. But because of (1) above, it seems like they are.)



来源:https://stackoverflow.com/questions/65145617/concurrent-and-sequential-statements-in-vhdl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!