Categorías

## The uvm_object class

The uvm_object class is the base class for all UVM classes. From it, all the rest of classes are extended. It provides basic functionalities such as print, compare, copy and similar methods.

This class can be used when defining reusable parts of a sequence items. For example, in a packet like uvm_sequence_item, we could define a uvm_object extended object for defining the header. This would be:

class packet_header extends uvm_object;

rand bit [2:0] len;

uvm_object_utils_begin(packet_header)
uvm_field_int(len, UVM_DEFAULT)
uvm_field_int(addr, UVM_DEFAULT)
uvm_object_utils_end

super.new(name);
endfunction : new

endclass : packet_header

This packet_header could be included in a packet class for conforming the uvm_sequence_item (the transaction) which will compose the sequences:

class simple_packet extends uvm_sequence_item;

uvm_field_object(header, UVM_DEFAULT)
uvm_object_utils_end
endclass : packet