qwerty123 Posted July 14, 2011 Report Share Posted July 14, 2011 I have declared a class of type byte_array, class byte_array extends uvm_object; byte a[]; `uvm_object_utils_begin(byte_array) `uvm_field_array_int(a,UVM_ALL_ON) `uvm_object_utils_end function new(int size); a = new; endfunction endclass In the sequence item class i have defined a variable of that type(byte_array). I have registered it with uvm_field object. But its giving an error. Whats the right way to do that? class abc extends uvm_sequence_item; byte_array payload; `uvm_object_utils_begin(abc) `uvm_field_object(payload,UVM_ALL_ON) `uvm_object_utils_end endclass Quote Link to comment Share on other sites More sharing options...
arno Posted July 14, 2011 Report Share Posted July 14, 2011 Check the class reference manual : the prototype of new for a uvm_object is function new (string name = "") Quote Link to comment Share on other sites More sharing options...
qwerty123 Posted July 15, 2011 Author Report Share Posted July 15, 2011 class byte_array extends uvm_object; byte a[]; `uvm_object_utils_begin(byte_array) `uvm_field_array_int(a,UVM_ALL_ON) `uvm_object_utils_end function new(string name = " byte_array" ,int size); a = new; super.new(name); endfunction endclass class abc extends uvm_sequence_item; byte_array payload; `uvm_object_utils_begin(abc) `uvm_field_object(payload,UVM_ALL_ON) `uvm_object_utils_end endclass I did the following changes, Its giving the following errors:- copy is not a class item. clone is not a class item. Quote Link to comment Share on other sites More sharing options...
arno Posted July 15, 2011 Report Share Posted July 15, 2011 The prototype of the new() function should be respected. Here is a possible solution for your purpose: class byte_array extends uvm_object; byte a[]; `uvm_object_utils_begin(byte_array) `uvm_field_array_int(a,UVM_ALL_ON) `uvm_object_utils_end function void set_byte_array_size(int size); a = new; endfunction endclass class abc extends uvm_sequence_item; byte_array payload=new(); int payload_size; `uvm_object_utils_begin(abc) `uvm_field_object(payload,UVM_ALL_ON) `uvm_object_utils_end function void set_payload_size(int size); payload.set_byte_array_size(size); endfunction endclass Then, when using class abc : abc myAbc=new(); initial myAbc.set_payload_size(5); 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.