Hi all ,
Is there a difference between if-else and implication Constraint ?
rand bit [1:0] a , b ;
constraint { if ( a == 1 )
b == 3 ;
}
The Same could be written through Implication Constraint as well
rand bit [1:0] a , b ;
constraint {
( a == 1 ) -> ( b == 3 ) ;
}
We could even club multiple expression when a == 1 is True
rand bit [1:0] a , b , c ;
constraint { if ( a == 1 )
{ b == 3 ; c == 3 ; }
}
rand bit [1:0] a , b , c ;
constraint { ( a == 1 ) -> ( b == 3 ; c == 3 ; )
}
So can they used interchangeably or is there any scenario where one is preferred over other ?