In reply to designer007:
take the some part to function
if there is some bug in f1 , we only have to modify the code in one place(f1), not everywhere
function f1();
my_transaction tr; //call serial function /task block1
start_item(tr);
tr = new("tr");
assert(tr.randomize());
endfunction
function f2();
finish_item(tr);
endfunction
virtual task cfg1(bit[47:0] dmac=0);
f1();
tr.dmac= dmac; //assign one field to specific value
f2();
endtask
virtual task cfg2(bit[47:0] dmac=0,
bit[15:0] ether_type=0
);
f1();
tr.dmac= dmac;
tr.ether_type= ether_type; //this one can assign 2 field to specific value
f2();
endtask
this is a better way , but i do not know if there is some other solution