Illegal assignment to class type uvm_component [...]from class type [...]

3 posts / 0 new
Last post
vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Illegal assignment to class type uvm_component [...]from class type [...]

Hi,
I have a variable (int) in my sequence. How can I set the value to it in my test case ??

My sequence looks like this:

class my_seq extends uvm_sequence#(my_txn);
int N; 
  `uvm_object_utils_begin(my_seqI) // register with factory
    `uvm_field_int (N,UVM_DEFAULT)
  `uvm_object_utils_end
  function new(string name);
    super.new(name);
  endfunction
 
  task body();   
    repeat (N)
      begin
	....
      end
  endtask:body  
 
endclass:my_seq

I have an handle for sequence in test. From My test case I want to control the value of N, Is there any other method other than assigning the value directly ?

dave_59
Offline
Verification Forum Moderator
Joined: 03/10/2010
Posts: 976
Re: Illegal assignment to class type uvm_component [...]from class type [...]

Don't understand the title of your post in relation to the question being asked.

For classes not derived from uvm_component, you must explicitly get the value from the config db.

if (!uvm_config_db#(int)(context,"",N)) `uvm_error("code","message);

Your context could be m_sequencer or it could be null if this is a global setting.

__________________

Dave Rich
Mentor Graphics
http://go.mentor.com/drich

vvs3693
Offline
Academy Total Access User
Joined: 11/02/2011
Posts: 12
Re: Illegal assignment to class type uvm_component [...]from class type [...]

Hi Dave,
Thanx... That worked for me...