We use a lot of constant functions in our code to setup parameters/localparams. This has worked quite nicely to setup our code, and works with multiple tools.
However, a new tool is choking on some of this logic, and the vendor is claiming that our usage is non-standard compliant. An example:
module foo1;
// Constant function1
function integer fun1( input integer a );
return( a + 1 );
endfunction
// Constant function2
function integer fun2( input integer b );
return( fun1( b + 1 ) );
endfunction
localparam VAL1 = 20;
localparam VAL2 = fun1( VAL1 ); // Constant function of a constant
localparam VAL3 = fun2( VAL1 ); // Constant function, of a constant function of a constant.
$info( "VAL1 = %0d, VAL2 = %0d, VAL3 = %0d", VAL1, VAL2, VAL3 );
endmodule
The claim is the assignment to VAL2 is valid, but VAL3 is not. From the 1800-2012 standard, section 13.4.3:
Constant functions shall not themselves use constant functions in any context requiring a constant
expression.
Is my new vendor accurate in the assessement of the standard? This a rather restrictive constraint - allowing only one level of constant function at elaboration?