Clock edge is not getting detected inside forever loop

In reply to rakesh2learn:

An additional remark: Move the creation of your transaction outside of the forever loop:
task run_phase(uvm_phase phase);
tx = ahb_tx::type_id::create(“tx”); // for every new collection, new tx item is created
forever begin
@(posedge vif.hclk); // here is the problem
tx.addr = vif.addr;

end
endtask