I have some sequence item defined as below.
class my_trans1 extends uvm_sequence_item;
bit a;
bit b;
bit c;
endclass
class my_trans2 extends uvm_sequence_item;
bit d;
bit e;
endclass
class my_trans3 extends uvm_sequence_item;
bit f;
endclass
and I want to create a function to implement that each member variable in each transaction is set to 0 like below psuedo-code shown. Actually it sounds like that the a,b,c in my_trans1 is set to 0 if I called set_zero(my_trans1 tr); and the d,e in my_trans2 will set to 0 if I called set_zero(my_trans2 tr)…
void function set_zero(uvm_sequence_item tr);
foreach member variable in the tr
tr.xxx = 0;
end
endfunction
I am not sure how to achieve it… please help on it if you have any good idea thank you !