While surfing through blogs and other posts I saw an example of calling a constraint without input argument
Normally when I have a function with input arguments ::
class Main ;
rand bit [3:0] a , b ;
constraint FUNC { b == FUNC( a ) ; }
constraint AA { a == 5 ; }
function int FUNC ( input bit [3:0] A ) ;
// Some Logic generally but I simply write ::
return A ;
endfunction
endclass
So this would have an implicit ordering
(1) First input to the function ( FUNC ) is solved i.e a is constrained to be 5 first
(2) Then function gets called and its return value is assigned to b ( So in our case b will be assigned 5 )
If I modify the code to ::
class Main ;
rand bit [3:0] a , b ;
constraint FUNC { b == FUNC() ; }
constraint AA { a == 5 ; }
function int FUNC ( ) ; // No arguments as input !!
return A ;
endfunction
endclass
How do the constraint get solved ?
Please correct me if wrong , LRM doesn’t talk about function without arguments used in Constraints .