Uvm_object_wrapper

class my_adapter extends uvm_reg_adapter;

  uvm_object_wrapper trans_type;

  `uvm_object_utils(my_adapter)

  function new(string name = "my_adapter");
    super.new(name);
  endfunction
  
  virtual function uvm_sequence_item reg2bus(const ref uvm_reg_bus_op rw);
    bus_packet pkt;  
    if(trans_type)  // getting warning here
      $cast(pkt, factory.create_object_by_type(trans_type, "", "pkt"));
    else pkt = bus_packet::type_id::create("pkt");  
    ---------------------------
      = conversion_logic =
    ---------------------------
    return pkt;
  endfunction: reg2bus

 ----------------
 ----------------
 ----------------
 ---------------
endclass : my_adapter


After executing the above code i am getting a warning like :


(vopt-2574) Use of class handles as logical operands is not portable

can anyone explain what is that warning means and how to clear the warning.

Thanks

In reply to lalithjithan:

As the message states, you shouldn’t use a class handle as a logic operand. Instead, you should use:


  if (trans_type != null)

In reply to cgales:

My question is what are you doing with the uvm_object_wraper and where the object comes from.