Jump to content

how to pass value to a variable that is a derivation of uvm_object and not uvm_component


Recommended Posts

Hi,

problem statement: I wanted to set a value to a variable that is derived of a uvm_object. I wanted to use the get/.set method

 

prvious code snippet:

 

function new(int len = 0)

  if(len > 0)

    this.length = len;

  else

    ERROR

endfunction

 

Given that now the UVM constructor has to be like 

function new(string name ="");

  super.new(name);

endfunction

 

I wanted to set the len, variable using the set method.

1) however the set/get method requires a logical hierarchy, given that this object is instantiated in a sequence object, I don't know what which way can you pass the sequence_item hierarchy. 

2) Also given that the ojbect does not have phasing involved unless I pass the value in some function and call the function explicitly it doesn't seem like it will work.

 

I wanted to know if there is an elegant way to do so?

 

Thanks,

Ankur

 

 

 

Link to comment
Share on other sites

Additional Info:

The variable is inside a class that gets instantiated inside the sequence_item. Like,

 

class pkt;

  cfg_pkt cfg_hndl;

 ...

endclass

 

class cfg_pkt extends uvm_object;

 

 int len;

Where to write this?

<<<<uvm_config_db #int::get(this,????,"len",len);>>>>>

OR

Given that the pkt class is tied to the sequencer, would it be like:

class pkt;

  task body();

    uvm_config_db#int::get(this.get_sequencer(),"","len",cfg_hndl.len);

  endtask

 

endclass

 

thanks,

Ankur

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.

Guest
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...