virtual function和类的多态性有关,使用户在设计和实现类时不需要担心句柄指向的对象类型是父类还是子类,只要通过虚方法,就可以进行动态绑定,或者SV中称为动态查找方法(摘自红宝书)。 简单理解就是,virtual function是基类中的函数模板,可在派生类中使用新代码重写该函数模板’,它存在对的目的就是为了后续能够重写该...
virtual function void set ( uvm_reg_data_t value, string fname = "",int lineno = 0 ) 设置模型中寄存器的期望值,不会改变DUT中这个寄存器的值。 1.2 get 1 virtual function uvm_reg_data_t get( string fname = "", int lineno = 0 ) 返回模型中寄存器的期望值,而不是DUT中的寄存器值。 1.3...
virtual function uvm_reg_data_t get_mirrored_value( string fname = "", int lineno = 0 ) 1. 返回模型中寄存器的镜像值。 1.4 get_reset virtual function uvm_reg_data_t get_reset( string kind = "HARD" ) 1. 返回寄存器的复位值。 1.5 predict virtual function bit predict ( uvm_reg_data_...
plaintext //间接基类Aclass A{protected:int m_a;};//直接基类Bclass B: virtual public A{ //虚继承protected:int m_b;};//直接基类Cclass C: virtual public A{ //虚继承protected:int m_c;};//派生类Dclass D: public B, public C{public:void seta(int a){ m_a = a; } //正确void ...
virtual function void start_of_simulation_phase(uvm_phase phase); super.start_of_simulation_phase(phase);`uvm_info(tID,"start_of_simulation_phase is executed",UVM_LOW)endfunction virtual taskrun_phase(uvm_phase phase);`uvm_info(tID, "run_phase is executed", UVM_LOW) ...
virtual function void build_phase(uvm_phase phase); super.build_phase(phase); `uvm_info("my_driver", "build_phase is called", UVM_LOW); if(!uvm_config_db#(virtual my_if)::get(this, "", "vif", vif)) `uvm_fatal("my_driver", "virtual interface must be set for vif!!!") ...
extern virtual function void build_phase(uvm_phase phase); extern virtual task void main_phase(uvm_phase phase); endclass function void my_driver:: build_phase(uvm_phase phase); //将顶层实例化的interface指针传递给driver的insterface super.build_phase(phase); ...
继承uvm_reg_adapter,重写reg2bus和bus2reg这两个pure virtual function。 classmy_adapterextendsuvm_reg_adapter; string tID = get_type_name; `uvm_object_utils(my_adapter) functionnew(string name="my_adapter"); super.new(name); endfunction :new ...
extern virtual task main_phase(uvm_phase phase); `uvm_component_utils(my_model) endclass function my_model::new(string name, uvm_component parent); super.new(name, parent); endfunction function void my_model::build_phase(uvm_phase phase); ...
virtual function void do_pack( uvm_packer packer ); bit R1; // reserved bit bit [5:0] R6; // reserved bits super.do_pack( packer ); packer.pack_field_int( .value( flavor ), .size( 3 ) ); packer.pack_field_int( .value( color ), .size( 2 ) ); ...