Hi
I meet an issue, I want to cast a base class handle to a child class,$cast(tlp_tr,tlp). But it don’t work(return 0).
I want to ask why sometimes we can cast base class handle to child class, but I cannot do it in my example. Thank you.
forever begin
apci_packet pkt ;
tlp_pkt tlp_tr ;
apci_tlp tlp ;
vg_pkt_bus_tr#(6) pkt_tr ;
#10ns ;
if (avy_fifo.used() > 0 ) begin
avy_fifo.get(pkt) ;
`uvm_info("get pkt from fifo",pkt.sprint(),UVM_HIGH)
if($cast(tlp,pkt)) begin
if(tlp.is_pure_mem) begin
`uvm_info(get_type_name(),tlp.get_type_name,UVM_HIGH)
if (**$cast(tlp_tr,tlp)**) begin
`uvm_info(get_type_name(),"cast ok",UVM_HIGH)
end
else begin