I modified an existing class to parameterized class with default values
I am getting following warning in VCS
Warning-[PCSRMIO] Class scope used outside of class
…/…/…/dv/src/env/cfm_cfs/cfm_cfs_env.svh, 180
“cf_agt_cfg_c::type_id::create”
An unspecialized class scope ‘::’ reference was seen. This refers to the
generic class, and may only be used inside the class ‘cf_agt_cfg_c’. To
access a static member of the default specialization outside the class
‘cf_agt_cfg_c’, use ‘cf_agt_cfg_c#()::’ instead. This will
be an error in a future release.
When I modified my agent , I expected the existing create functions of respective class will not effect
As I am providing default values for parameters.
Why we getting this warning ?
How come compiler not considering default parameters, if we dont mention during declaration and creation of object ?
Thank you for your help
In reply to hemum_p:
The warning message has told you: you need to use an empty #() to specify that want the default parameter value assignments used. When ever you define a parameterized class, you should always add #(something) to every reference to that class. SV was recently changed to clarify this ambiguous case:
class A#(int P=1);
static int i=P;
function void f;
$display(A::i,,P);
endfunction
endclass
People expect A::i to have the same value as P, but unfortunately SV considers ‘A’ without the #() to mean A#(default value). So without this change, A::i would always equal 1, regardless of how P was overridden. Now A::i inside the scope of A means A#(P)::i. Along with this change comes the requirement that outside of the scope of A you must use A#()::i so that A::i does not mean two different sets of parameters.
It is a good programming practice whenever you refer to a parameterized class to always add the #(something) for any kind of reference, not just a scope operator.