Jump to content


Recommended Posts


I found such codes as this:

package uvm_config_prop_pkg;


class uvm_config_prop #(type T=int) extends uvm_object;


static function void set_config (string target, string field, T value, uvm_component cntxt=null);

uvm_config_prop #(T) wrapper = new(value);


endfunction : set_config


I was confused by the code with this:

uvm_config_prop #(T) wrapper = new(value);

how can a function belongs to a class to "new" a class as itself? Can anybody help me to understand this? thanks.

Link to comment
Share on other sites


the magic of this is that the set_config is a static function (your are calling it upon the type and not upon an instance). so with that you say sometype::function() which calls function without having an instance. so this code is a static function which in its body allocates a dynamic object using new.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...