#C8# UVM中的factory机制 #S8.2.2# 复杂重载方式

今天看一下稍微复杂些的重载方式。

一 连续重载

文件:src/ch8/section8.2/8.2.3/consecutive/my_case0.sv
 81 function void my_case0::build_phase(uvm_phase phase);
 82      bird bird_inst;
 83      parrot parrot_inst;
 84      super.build_phase(phase);
 85
 86      set_type_override_by_type(bird::get_type(), parrot::get_type());
 87      set_type_override_by_type(parrot::get_type(), big_parrot::get_type());
 88
 89      bird_inst = bird::type_id::create("bird_inst");
 90      parrot_inst = parrot::type_id::create("parrot_inst");
 91      print_hungry(bird_inst);
 92      print_hungry(parrot_inst);
 93 endfunction

输出结果如下: 

内部机制:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

那么菜

你的鼓励和批评是我最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值