Hi All ,
A recent thread invoked interest whether ternary operator can replace if - else .
The example in the thread has consequent in non-temporal context .
I was wondering if ternary operator can replace if-else in temporary context as well :
Consider the following concurrent assertion where the if-else is used in temporal context :
property ife ;
@( posedge clk ) a ##1 ( b || c )[->1 ] |-> if( b ) ( ##1 d ) else ( ##1 e ) ; // Consequent is Temporal due to ##1d and ##1 e
endproperty
Now when I try using ternary operator :
property Ternary ;
@( posedge clk ) a ##1 ( b || c )[->1 ] |-> ( b == 1 ) ? ( ##1 d ) : ( ##1 e ) ; // Syntax error !!
endproperty
Any suggestions on how could I resolve the compilation error ? Also can a temporal expression be written using ternary operator ?