`define uvm_field_utils_begin(T) \ function void __m_uvm_field_automation (uvm_object tmp_data__, \ int what__, \ string str__); \ begin \ T local_data__; /* Used for copy and compare */ \ typedef T ___local_type___; \ string string_aa_key; /* Used for associative a...
如uvm_field_aa_int_string用于声明存储的数据是int,索引为string的类型的联合数组。 `uvm_field_aa_int_string(ARG,FLAG)`uvm_field_aa_string_string(ARG,FLAG)`uvm_field_aa_object_string(ARG,FLAG)`uvm_field_aa_int_int(ARG,FLAG)`uvm_field_aa_int_int_unsigned(ARG,FLAG)`uvm_field_aa_int_inte...
virtual function bit do_compare (uvm_object rhs,uvm_comparer comparer); mytype rhs_; do_compare = super.do_compare(rhs,comparer); $cast(rhs_,rhs); do_compare &= comparer.compare_field_int("f1", f1, rhs_.f1); endfunction endclassuvm...
1.5与关联数组有关的uvm_field系列宏 注1:宏中第一个类型是存储数据的类型,第二个类型是索引类型,如`uvm_filed_aa_int_string用于声明存储的数据是int类型,而其索引是string类型的关联数组; 2.该机制的功能? 2.1 提供copy,clone,compare,print,pack_bytes等函数,而不需user定义(详见《UVM实战》3.3.2) (1) ...
UVM从uvm_void扩展而来,因此所有的类都可以使用其函数。常用的函数有:print、sprint、copy、clone、compare、record、pack/unpack。 UVM_FIELD_*宏 例如,定义一个32位变量sa:verilog uvm_field_int(sa, UVM_ALL_ON | UVM_NOCOPY)这里,UVM_ALL_ON表示所有权限打开,UVM_NOCOPY表示不复制数据。
1. 前面的my_print,my_copy,my_compare函数,虽然各自不同,但对于transaction来说,都是类似的。使用UVM中的field_automation机制,可以自动实现这3个函数,不需要我们写,my_transaction: `ifndef MY_TRANSACTION__SV `define MY_TRANSACTION__SV class my_transaction extends uvm_sequence_item; ...
1.field_automation机制 对field_automation最直观的感受是,他可以自动实现copy、compare、print等三个函数。当使用uvm_field系列相关宏注册之后,可以直接调用以上三个函数,而无需自己定义。这极大的简化了验证平台的搭建,尤其是简化了driver和monitor,提高了效率。
引入field_automation机制的原因: 自动实现my_transaction中print、copy、compare这样的比较常见的结构体操作,简化my_transaction的实现。同时默认的pack_bytes(tr中的各个字段转换成byte流)和unpack_bytes(byte流转换成tr中的各个字段)也简化了driver、monitor的实现。
`uvm_field_int(vlan_info4, UVM_ALL_ON) end `uvm_field_int(ether_type, UVM_ALL_ON) `uvm_field_array_int(pload, UVM_ALL_ON) `uvm_field_int(crc, UVM_ALL_ON | UVM_NOPACK) `uvm_field_int(is_vlan, UVM_ALL_ON | UVM_NOPACK) ...
`uvm_field_int(crc, UVM_ALL_ON) `uvm_object_utils_end endclass: crc7_transaction class crc7_sequence extends uvm_sequence#(crc7_transaction); `uvm_object_utils(crc7_sequence) function new(string name = ""); super.new(name);