# VCS Warning for Parameter Class creation ! How to default parameters in parameterized classes?

**URL:** <https://verificationacademy.com/forums/t/vcs-warning-for-parameter-class-creation-how-to-default-parameters-in-parameterized-classes/31890>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, Parameterized-classes, Default-parameters\
**Created:** [June 2, 2016, 6:57pm UTC](https://verificationacademy.com/forums/t/vcs-warning-for-parameter-class-creation-how-to-default-parameters-in-parameterized-classes/31890 "2016-06-02T18:57:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemum\_p](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@hemum\_p](https://verificationacademy.com/forums/u/hemum_p)\
**Post date:** [June 2, 2016, 6:57pm UTC](https://verificationacademy.com/forums/t/vcs-warning-for-parameter-class-creation-how-to-default-parameters-in-parameterized-classes/31890/1 "2016-06-02T18:57:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [June 2, 2016, 8:47pm UTC](https://verificationacademy.com/forums/t/vcs-warning-for-parameter-class-creation-how-to-default-parameters-in-parameterized-classes/31890/2 "2016-06-02T20:47:08Z")

</div>

_In reply to [hemum\_p](https://verificationacademy.com/forums/t/vcs-warning-for-parameter-class-creation-how-to-default-parameters-in-parameterized-classes/31890):_

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:

```verilog
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.
