Hi,
I’m trying to understand the difference between uvm_object_utils() and uvm_object_utils_begin()~end().
Currently I’m learning site UVM/Performance Guidelines | Verification Academy. In here,
2 example show up as below,
(1). Lower performance.
// APB Bus sequence_item
class apb_seq_item extends uvm_sequence_item;
bit[31:0] addr;
bit[31:0] data;
apb_opcode_e we;
// Field macros:
`uvm_object_utils_begin(apb_seq_item)
`uvm_field_int(addr, UVM_DEFAULT)
`uvm_field_int(data, UVM_DEFAULT)
`uvm_field_enum(we, apb_opcode_e, UVM_DEFAULT)
`uvm_object_utils_end
function new(string name = "apb_seq_item");
super.new(name);
endfunction
endclass: apb_seq_item
(2) higher performance.
// APB Bus sequence_item
class apb_seq_item extends uvm_sequence_item;
bit[31:0] addr;
bit[31:0] data;
apb_opcode_e we;
`uvm_object_utils(apb_seq_item)
function new(string name = "apb_seq_item");
super.new(name);
endfunction
// Sequence Item convenience method prototypes:
extern function void do_copy(uvm_object rhs);
extern function bit do_compare(uvm_object rhs, uvm_comparer comparer);
extern function string convert2string();
extern function void do_print(uvm_printer printer);
extern function void do_record(uvm_recorder recorder);
extern function void do_pack();
extern function void do_unpack();
endclass: apb_seq_item
So I was made one example for test above example in TLM-10 A Single Port Analysis FIFO(1) - EDA Playground
But I’m confused that when I change to see the result from uvm_object_utils_begin~end() to uvm_object_utils(), I can’t print transaction sequence items list.
class transaction extends uvm_sequence_item;
//---------------------------------------
// Variable Declaration
//---------------------------------------
bit [7:0] dout;
rand bit [7:0] din;
rand bit [3:0] addr;
rand bit wr_rd;
rand bit [7:0] wdata;
//---------------------------------------
// Utility and Field macros
//---------------------------------------
`uvm_object_utils(transaction)
//---------------------------------------
//Constructor
//---------------------------------------
function new(string name = "transaction");
super.new(name);
endfunction
endclass
vs
class transaction extends uvm_sequence_item;
//---------------------------------------
// Variable Declaration
//---------------------------------------
bit [7:0] dout;
rand bit [7:0] din;
rand bit [3:0] addr;
rand bit wr_rd;
rand bit [7:0] wdata;
//---------------------------------------
// Utility and Field macros
//---------------------------------------
`uvm_object_utils_begin(transaction)
`uvm_field_int(addr,UVM_ALL_ON)
`uvm_field_int(wr_rd,UVM_ALL_ON)
`uvm_field_int(wdata,UVM_ALL_ON)
`uvm_object_utils_end
//---------------------------------------
//Constructor
//---------------------------------------
function new(string name = "transaction");
super.new(name);
endfunction
endclass
When I ran above 2 example, I got this print
UVM_INFO component_a.sv(30) @ 0: uvm_test_top.env.comp_a [component_a] Printing trans,
-------------------------------
Name Type Size Value
-------------------------------
trans transaction - @2356
-------------------------------
vs
UVM_INFO component_a.sv(30) @ 0: uvm_test_top.env.comp_a [component_a] Printing trans,
---------------------------------
Name Type Size Value
---------------------------------
trans transaction - @2356
dout integral 8 'h0
din integral 8 'ha3
addr integral 4 'ha
wr_rd integral 1 'h1
wdata integral 8 'hb1
---------------------------------
When I printed out about sequence items I expected that I would get a transaction list items. But uvm_object_utils() can’t get a transaction item list.
Could you guide me please?