Hi Forum ,
Having established a basic understanding of SV assertions I decided to delve into multi-clocked assertions .
I started referring to book by author Ashok Mehta where I read the following quote
“There are differences in the way a ‘sequence’ behaves for multiple clocks and the way property behaves”
Since the book doesn’t elaborate further on it I decided to start trying out examples in the book.
One such example where I observe a difference in sequence and property behavior is :
property multiclocks ;
@(posedge clk2) y and @(posedge clk3) z ;
endproperty
try1:assert property ( @(posedge clk1) x |=> multiclocks );
The above code executes whereas on changing it to :
sequence multiclocks ;
@(posedge clk2) y and @(posedge clk3) z ;
endsequence
try2:assert property ( @(posedge clk1) x |=> multiclocks );
In this case I observe tools start throwing compilation errors like
(tool1) Error-[SVA-CMISO] Clocks mismatch in sequence operator.
(tool2) Sequence/SERE 'multiclocks' declared in 'top' has multiple leading clocks. Such sequence/SERE cannot be instanced as maximal property of a directive.
I tried searching the System Verilog LRM for the same but wasn’t successful :(
Would like to hear from the forum members and moderators on the above scenario .
Why do ‘sequences’ behave differently than ‘property’ for multiple clocks ?
I was under the impression that both ‘sequence’ and ‘property’ are valid as consequent.
Does the LRM have an example on the it ? If yes, could someone please point to the same
/* 1800: 16.13.1: Differently clocked or multiclocked sequence operands cannot be combined with any
sequence operators other than ##1 and ##0.
For example, if clk1 and clk2 are not identical, then the following are illegal:
@(posedge clk1) s1 ##2 @(posedge clk2) s2
@(posedge clk1) s1 intersect @(posedge clk2) s2 */
This is why the sequence declaration sequence multiclocks_err fails to compile.
However, if the leading clock is unique, a property can change clocks on all ops.
Test I conducted: The following code compiled and simmed OK by all.
However if I include try2:assert property ( @(posedge clk1) x |=> multiclocks_err );
then all 3 vendors flagged the sequence as an error.
module test();
bit clk1, clk2, clk3, x, y, z;
property multiclocks ;
@(posedge clk2) y and @(posedge clk3) z ;
endproperty
try1:assert property ( @(posedge clk1) x |=> multiclocks );
//The above code executes whereas on changing it to :
/* sequence multiclocks_err ;
@(posedge clk2) y and @(posedge clk3) z ;
endsequence
try2:assert property ( @(posedge clk1) x |=> multiclocks_err ); */
initial #100;
endmodule
Ben Cohen Ben@systemverilog.us
Link to the list of papers and books that I wrote, many are now donated.
I am still not clear on my original doubt. In your earlier reply you commented :
However, if the leading clock is unique, a property can change clocks on all ops.
Could you please elaborate on this ? Why is it applicable for only property and not for a sequence ?
1800: 16.13.1: Differently clocked or multiclocked sequence operands cannot be combined with any sequence operators other than ##1 and ##0.
For example, if clk1 and clk2 are not identical, then the following are illegal:
@(posedge clk1) s1 ##2 @(posedge clk2) s2
@(posedge clk1) s1 intersect @(posedge clk2) s2
The above applies to both property as well as sequences , right ?
So why is it that the following is legal
property multiclocks ;
@(posedge clk2) y and @(posedge clk3) z ; // Legal
endproperty
try1:assert property ( @(posedge clk1) x |=> multiclocks );
whereas the following is illegal
sequence multiclocks ;
@(posedge clk2) y and @(posedge clk3) z ; // Illegal
endsequence
try2:assert property ( @(posedge clk1) x |=> multiclocks );
You can only switch clocks in sequences with the ##0 or the ##1
The clock flow cannot change in the RHS of ‘and’ operator.
ILLEGALS
try2:assert property ( @(posedge clk1) 1 ##0 @(posedge clk2) y and
1 ##0 @(posedge clk3) z );
// The clock flow cannot change in the RHS of 'and' operator.
try3:assert property ( @(posedge clk1) 1 ##0 @(posedge clk2) y and @(posedge clk3) z );
You can also switch clocks between a sequence and a property with the |-> or the |=>
If the leading clock is unique, a property can change clocks on all ops.