In reply to ben@SystemVerilog.us:
For [Q2] I tried changing sequence ‘dynamic_delay’ with only RHS sequence :
sequence dynamic_delay(count); // Actual argument is 0
int v;
( (1, v=count,$display("T:%0t v=count",$time) ) ##0 (v>0,v=v-1)[*0:$] ##1 (v<=0,$display("T:%0t RHS Sequence matches",$time)) );
endsequence
The assertion fails at T:5 : edalink3 due to ( v>0 ) being false.
On changing the code to :
sequence dynamic_delay(count);
int v;
( (1, v=count,$display("T:%0t v=count",$time) ) ##0 first_match( (v>0, v=v-1) [*0:$] ##1 (v<=0,$display("T:%0t RHS Sequence matches",$time)) ) );
endsequence
Now I do observe “T:5 RHS Sequence matches” when calling dynamic_delay(0)
However in the original code ( edalink2 ) since the expression within dynamic_delay(0) is equivalent to:
(count<=0) or ( ( (1,v=count) ##0 (v>0, v=v-1)[*0] ##1 (v<=0) ) or ( (1,v=count) ##0 (v>0, v=v-1)[*1] ##1 (v<=0) ) or ... ( (1,v=count) ##0 (v>0, v=v-1)[*N] ##1 (v<=0) ) )
LHS sequence : ( count<=0) is a match at T:5
RHS sequence consists of multiple sequences 'or’ed : ( seq1 or seq2 or … seqn )
( (1,v=count) ##0 (v>0, v=v-1)[*0] ##1 (v<=0,$display("T:%0t RHS Sequence matches",$time) ) ) or // seq1
( (1,v=count) ##0 (v>0, v=v-1)[*1] ##1 (v<=0,$display("T:%0t RHS Sequence matches",$time) ) ) or // seq2
............................................................................................ or
( (1,v=count) ##0 (v>0, v=v-1)[*N] ##1 (v<=0,$display("T:%0t RHS Sequence matches",$time) ) )
seq1 has a empty sequence ( (v>0, v=v-1)*[0] ) due to which it can re-written as : (1,v=count) ##0 (v<=0,$display(“T:%0t RHS Sequence matches”,$time))
So why is it that RHS sequence isn’t considered a match at T:5 ? ( since I don’t observe “T:5 RHS Sequence matches” for edalink2 )
Since the input argument ‘count’ is 0, the sequence (v>0) fails for ALL sub-sequences of the RHS sequence i.e essentially RHS sequence ends at T:5.
As per my understanding sub-sequence seq1 does match at T:5, however there is no message “T:5 RHS Sequence matches” in output :(
Am I missing something ?