Hi All,
I was going through LRM while trying to understand the working of following code
bit a , b ;
logic c;
always@(a+b)
$display("T:%0t a+b is %0d",$time,a+b);
always@(c)
$display("T:%0t c is %0d",$time,c);
always@(edge c)
$display("T:%0t @(edge c) triggered with c == %0d",$time,c);
initial begin
#10; a = 1 ; b = 1;
end
initial begin
#5; c = 1'bZ;
end
LRM 9.4.2 Event Control says
More precisely, an edge event can be described as:
— An edge shall be detected whenever negedge or posedge is detected.
A non-edge implicit event shall be detected on any change in the value of the expression. However, an edge event shall be detected only on the LSB of the expression. A change of value in any operand of the expression without a change in the result of the expression shall not be detected as an event
I observe that always@(a+b) doesn’t trigger (on 3 eda tools) as the result of a+b (calculated using default precision of 1-bit) is 0 which is same as initial sum of default value of a & b
(Q1) I am not clear why always@(c) unblocks at T:5 units while always@(edge c) doesn’t.
I was under the impression that @(sig) is same as @(edge sig)
I believe always@(edge c) doesn’t unblock as c transitions from x to z which is “No edge” as per LRM
(Q2) What does LRM mean by “non-edge implicit event“ ?
(Q3) Do all the above rules regarding event control apply to event control (@(posedge clk)) used within a concurrent assertion as well ?
(Q4) Is assert property( @(a) seq_expr) different than
assert property( @(edge a) seq_expr) ?