遇到的问题:
In a transaction class, I have a static size array, and I registered it to UVM factory using "uvm_field_sarray_int".
在transaction class中,有一个固定大小的array,并且用uvm_field_sarray_int 宏注册了这个array。
The size of this array is 44.
array大小为44;
Now when I am trying to print this transaction class, either using transaction_class.print(), or using sprintf(), other members are getting print but for this array, it prints the first 5 entries and truncates the remaining. Is there anything UVM/SV specific that I am not using, which is making the printout to be truncated version? When I do a specific foreach loop to print all the contents of this array, I do see item getting printed.
当尝试使用transaction_class.print()或者sprintf()打印transaction内容时,输出的结果如下图所示,是截断的,只有前后的部分输出,如何将其全部打印输出呢? 难道要用for loop??
[0] integral 1 'h0
[1] integral 1 'h1
[2] integral 1 'h0
[3] integral 1 'h1
[4] integral 1 'h0
... ... ... ...
[39] integral 1 'h0
[40] integral 1 'h0
[41] integral 1 'h0
[42] integral 1 'h0
[43] integral 1 'h0
结论:
The field macros have significant limitations when printing different data types/arrays.
field宏打印输出时是有些限制的。
It is highly recommended to not use the field macros and instead implement the required transaction methods so you have control over how your transaction is displayed.
可以定义一个专门用于输出的函数。