为什么在敏感列表中描述的逻辑重新分配时总是阻止不重新激活 [英] Why always block not reactivating when there is a reassignment of logic described in sensitivity list

查看:32
本文介绍了为什么在敏感列表中描述的逻辑重新分配时总是阻止不重新激活的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

信号 driver_a 在 always 块中重新分配回 0,但是为什么 always 块没有激活并为 driver_b 赋值?

Signal driver_a is reassigned in the always block back to 0, but why is the always block not activating and assign value to driver_b ?

always @(driver_a) begin
driver_b = driver_a;
driver_a = 0;
end

initial begin
driver_a = 0; driver_b = 0;
#2 driver_a = 8'h8;
#2 driver_a = 8'hf;
end

在波形中,我希望在 driver_a 将其值分配给 driver_b 之后,然后在下一行当 driver_a 被分配为 0 时,我希望 always 块重新激活并将值 0 分配回 driver_b.

In the waveform, I expect that after driver_a assigns its value to driver_b, then in the next line when driver_a gets assigned to 0, I'd expect the always block to reactivate and assign value 0 back to driver_b.

然而事实并非如此,波形似乎表明一旦 driver_a 在 always 块中被分配为 0,always 块不会重新激活并将 0 分配回 driver_b 的值.简而言之,我希望 driver_b 的值始终保持为 0,因为 always 块中的代码在零模拟时间内执行.

however this is not the case, the waveform seems to show that once the driver_a gets assigned to 0 in the always block, the always block does not reactivate and assign 0 back to driver_b's value. In short I'd expect driver_b's value to always remain 0, since code within an always block executes in zero simulation time.

我附上了结果波形的图像,如下

I have attached the image of the resulting waveform, below

推荐答案

因为代码被解释为单一有序的语句集.就像你写的一样

Because the code is interpreted as single ordered set of statements. It's the same as if you had written

always begin
     @(driver_a)           // 1
     driver_b = driver_a;  // 2
     driver_a = 0;         // 3
end

Statement//1 表示等待 driver_a 改变"语句//2 表示将 driver_b 更改为 driver_a 的值"语句//3 表示将 driver_a 更改为 0"

Statement //1 means "Wait for driver_a to change" Statement //2 means "Change driver_b to the value of driver_a" Statement //3 means "Change driver_a to 0"

因为always块是一个以串行顺序执行语句的单线程,所以当它循环回到执行//1时已经发生了//3的变化.

Because the always block is a single thread that executes the statements in serial order, the change from //3 has already happened when it loops back to execute //1.

这篇关于为什么在敏感列表中描述的逻辑重新分配时总是阻止不重新激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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