Hi,
Can somebody help me to understand how factory.set_inst_override_by_type work when the override class contains an original class object?
A original_type
B override_type, which contains A object
When use B override A, should I expect the A_obj also get override?
I tried it on irun, it gets stuck?
module tb;
import uvm_pkg::*;
`include "uvm_macros.svh"
class A extends uvm_object;
rand bit[7:0] pkt_len;
`uvm_object_utils_begin(A)
`uvm_field_int(pkt_len, UVM_ALL_ON)
`uvm_object_utils_end
function new(string name="A");
super.new(name);
endfunction // new
endclass // A
typedef enum {ETH, IPV4} pkt_type_e;
class B extends A;
rand pkt_type_e pkt_type;
A A_obj;
`uvm_object_utils_begin(B)
`uvm_field_enum(pkt_type_e, pkt_type, UVM_ALL_ON)
`uvm_field_object(A_obj, UVM_ALL_ON)
`uvm_object_utils_end
function new(string name="B");
super.new(name);
A_obj = A::type_id::create("A");
endfunction // new
endclass // B
class test1 extends uvm_test;
A A1;
B B1;
`uvm_component_utils(test1)
function new(string name="test1", uvm_component parent);
super.new(name, parent);
endfunction // new
function void build_phase(uvm_phase phase);
super.build_phase(phase);
A::type_id::set_inst_override(B::get_type(), "*");
A1 = A::type_id::create("A1");
A1.print();
endfunction // build_phase
endclass // test1
initial run_test("test1");
endmodule