"If" 在 always 块的敏感列表中的 always OR 条件内?

"If" inside an always OR condition in the sensitivity list of the always block?

这两个代码的行为是否相同?

always @(a == 1'b1) // I guess for this one, it's like a combinational if (AND gate logic : a AND 1).
    // code

always @(a) begin // I guess for this one, if a= 1 from the time 0,
                  // it won't go inside since there wouldn't be any change.
    if (a == 1) begin
    // code
    end
end

是真的吗?

这是一个基本问题,但我想知道我是否遗漏了什么,谢谢!

不,两者不一样。

Note that variables in the sensitivity list are considered as an event and hence they are not executed, rather just change in the variable is considered as a trigger to that event.

所以第一个总是阻塞

always @ (a==1'b1)

等同于:

always @ (a)

所以第一个总是块将执行同时a = 1和0,而在第二种情况下,因为"if"条件,所以只执行a = 1