Jump to content

Error in registering


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);

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