信号分配如何在进程中工作? [英] How does signal assignment work in a process?

查看:37
本文介绍了信号分配如何在进程中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到信号在遇到表达式时不会立即改变,而是在过程结束时改变.在此示例中:

I learned that a signal is not changed immediately when encountering an expression, but when the process ends. In this example here:

...
signal x,y,z : bit;
...
process (y)
begin
  x<=y;
  z<=not x;
end process;

这个例子是这样说的:

如果信号 y 发生变化,那么将在 x 上安排一个事件,使其与 y 相同.此外,在 z 上安排了一个事件,使其与 x 相反.问题是,z 的值会与 y 的值相反吗?当然,答案是否定的,因为在执行第二条语句时,x 上的事件还没有被处理,调度在 z 上的事件将与进程开始前 x 的值相反.

好吧,我需要了解一些事情:

Well, I need to understand some things:

  1. 据我所知,信号值仅在过程结束时更新.这是正确的吗?
  2. 信号 x 被更新为第一条语句.这仍然不会改变x的值,这个改变被放入一个队列中,待进程结束后执行.所以在这个语句 x <= y 之后的所有内容都不会看到更改,并且会看到 x 具有其旧值.这是正确的吗?
  3. 第二个语句试图改变信号 z 的值.这里同样,z 不会改变它的值,但它取决于另一个进程的值.z 上的更改将放入队列以在进程结束时执行.这是正确的吗?
  1. From what I learned, signals values are updated only at the end of the process. Is this correct?
  2. The signal x is updated as the first statement. This does not still change the value of x, this change is put in a queue to be executed after the process ends. So everything after this statement x <= y will not see the change and will see x having its old value. Is this correct?
  3. The second statement is an attempt to change the value of signal z. The same here, z will not change its value but it depends on the value of another process. The change on z will be put in queue to be executed at the end of the process. Is this correct?

过程结束时会发生什么?

What does happen at the end of the process?

可能性编号 1) x 中的值被更改,因此 x 具有新值.第二个信号z被更新,第一个信号x被更新,假设z依赖于x,它的值根据 x 的 NEW UPDATED 值更改.该示例应该可以正常工作.

Possibility number 1) The value in x is changed so x has its new value. The second signal z is updated, the first signal x was updated and, given that z depends on x, its value is changed basing on the NEW UPDATED value of x. And the example should work fine.

可能性数 2) x 中的值被改变,所以 x 有新的值.第二个信号z被更新.鉴于 z 被分配了一个 x 的旧值,这就是 z 将保存的值,x 的旧值code> 已更新,但不考虑此更新.

Possibility number 2) The value in x is changed so x has its new value. The second signal z is updated. Given that z was assigned an old value of x, that's the value that z will hold, the old value of x which was updated, but this update is not considered.

你能告诉我哪个是正确的方法吗?

Could you please tell me which one is the correct way?

推荐答案

变量在您分配时更新.信号在下一个增量周期(最早)中得到更新.

Variables get updated as you assign them. Signals get update in the next delta cycle (at the earliest).

a := '1'; -- variable
assert a = 1;
b <= '1'; -- signal
computationUsing(b); --reads old value of b
-- new value will be visible after this process ends or some time passes

Jan Decaluwe 在此处更详细地解释了这些内容:http://www.sigasi.com/content/vhdls-crown-jewel

Jan Decaluwe explains this stuff in more detail here: http://www.sigasi.com/content/vhdls-crown-jewel

这篇关于信号分配如何在进程中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆