I was going through examples related to sequence method .ended and came across following code ::
bit clk , a , b , endbranch ;
initial forever #5 clk = !clk ;
sequence branch( a , b ) ;
@( posedge clk ) $rose( a ) ##[1:5] $rose( b ) ##0 ( 1 , $display("TIME: %2t Sequence branch Completes " , $time ) ) ;
endsequence
property endCycle ;
@( posedge clk ) branch( a , b ).ended |=> $rose( endbranch ) ;
endproperty
ap_test: assert property( endCycle ) $display("TIME: %2t Assertion PASS " , $time );
else $display("TIME: %2t Assertion FAILS " , $time );
initial begin
`ifdef M1
#4 ; a = 1 ;
#30 ; b = 1 ;
#10 ; endbranch = 1 ;
`elsif M2
#4 ; a = 1 ;
#20 ; endbranch = 1 ;
#20 ; b = 1 ;
#10 ;
`endif
#2 ; $finish();
end
For the 2nd case ( +define+M2 ) the assertion fails at TIME : 55 since the Consequent is false .
Consequent is evaluated only at TIME : 55 .
Is it possible to modify the above code such that for +define+M2 the assertion fails when $rose( endbranch ) is True when ’ branch ’ is still executing ?
i.e I want the assertion to fail at TIME: 25 for +define+M2