uvm_object类是所有UVM数据以及层次结构的基类,其主要的角色是定义一系列的方法,比如一些公共的操作:create(), copy(), compare(), print(), record()等。
其中的 create() 与 get_type_name() 虚方法被简单实现,不再是纯虚方法。但在扩展类中如果需要使用与这两种方法的相关方法时必须实现这两种方法。1. 层次结构uvm_object扩展自uvm_void2. 类的预定义预定义uvm_object的相关扩展类,以便在uvm_object的相关方法中调用:typedef class uvm_report_object;typedef class uvm_object_wrapper;typedef class uvm_objection; // uvm_object类中未使用typedef class uvm_component; // uvm_object类中未使用typedef class uvm_status_container;123453. 类的声明virtual class uvm_object extends uvm_void;endclass124. 类的方法变量的声明 // 静态变量,决定是否使能UVM中的播种机制,影响全局的reseed()方法; static bit use_uvm_seeding = 1; // 局部变量,通过new函数将类的实例化名传递给该变量,变量对子类及外部不可见; local string m_leaf_name; // 局部变量,使用new()函数实例化类时,m_inst_count自动加1并传递给该局部变量,用于返回实例化id,变量对子类及外部不可见; local int m_inst_id; // 静态局部变量,用于返回实例化次数,该局部变量对子类可见,对外部不可见; static protected int m_inst_count; static uvm_status_container m_uvm_status_container = new; // 查找表,用于copy()函数的实现; local static uvm_object uvm_global_copy_map[uvm_object];12345678910111213141516方法的声明 extern function new (string name=""); extern static function int get_inst_count(); extern virtual function int get_inst_id (); extern virtual function string get_name (); extern virtual function string get_full_name (); extern virtual function void set_name (string name); virtual function string get_type_name (); return “”; endfunction virtual function uvm_object create (string name=""); return null; endfunction extern function void reseed (); extern static function uvm_object_wrapper get_type (); extern virtual function uvm_object_wrapper get_object_type (); extern virtual function uvm_object clone (); extern function void print (uvm_printer printer=null); extern function string sprint (uvm_printer printer=null); extern virtual function void do_print (uvm_printer printer); extern virtual function string convert2string(); extern function void record (uvm_recorder recorder=null); extern virtual function void do_record (uvm_recorder recorder); extern function void copy (uvm_object rhs); extern virtual function void do_copy (uvm_object rhs); extern function bit compare (uvm_object rhs, uvm_comparer comparer=null); extern virtual function bit do_compare (uvm_object rhs, uvm_comparer comparer); extern function int pack (ref bit bitstream[], input uvm_packer packer=null); extern function int pack_bytes (ref byte unsigned bytestream[], input uvm_packer packer=null); extern function int pack_ints (ref int unsigned intstream[], input uvm_packer packer=null); extern virtual function void do_pack (uvm_packer packer); extern function int unpack (ref bit bitstream[], input uvm_packer packer=null); extern function int unpack_bytes (ref byte unsigned bytestream[], input uvm_packer packer=null); extern function int unpack_ints (ref int unsigned intstream[], input uvm_packer packer=null); extern virtual function void do_unpack (uvm_packer packer); extern virtual function void set_int_local (string field_name, uvm_bitstream_t value, bit recurse=1); extern virtual function void set_string_local (string field_name, string value, bit recurse=1); extern virtual function void set_object_local (string field_name, uvm_object value, bit clone=1, bit recurse=1); extern local function void m_pack (inout uvm_packer packer); extern local function
如何实例化uvm_object
最新推荐文章于 2023-12-13 16:12:19 发布