arb Posted June 14, 2014 Report Share Posted June 14, 2014 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 Quote Link to comment Share on other sites More sharing options...
arb Posted June 14, 2014 Author Report Share Posted June 14, 2014 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 Quote Link to comment Share on other sites More sharing options...
arb Posted June 14, 2014 Author Report Share Posted June 14, 2014 The problem with uvm_cofnig_db#(int)::get(this.get_sequencer(),"","len",cfg_hdnl.len); is that, the 3rd argument "len" is not a member of pkt class, so how do you pass the string name for len? Thanks, Ankur Quote Link to comment Share on other sites More sharing options...
tudor.timi Posted June 15, 2014 Report Share Posted June 15, 2014 You could work around the issue by doing something like: task body(); int len; uvm_config_db#int::get(this.get_sequencer(),"","len",len); cfg_hndl.len = len; // ... endtask Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.