2

对于使用`uvm_field_queue_int实用程序宏的 UVM 对象,UVM 在调用时不会打印出整个队列my_object.print()

# -----------------------------------------
# Name Type Size Value
# -----------------------------------------
# my_object my_object - @443
# data_q da(integral) 16 -
# [0] integral 32 'h203f922b
# [1] integral 32 'he4b3cd56
# [2] integral 32 'hd7477801
# [3] integral 32 'h3a55c481
# [4] integral 32 'h2abf98c4
# ... ... ... ...
# [11] integral 32 'hac0d672b
# [12] integral 32 'h3ba2cb5d
# [13] integral 32 'hbe924197
# [14] integral 32 'h3cc6d490
# [15] integral 32 'h69ae79da
# -----------------------------------------

让 UVM 打印整个队列的最佳方法是什么?

EDA Playground 上的示例代码:http ://www.edaplayground.com/x/rS

4

1 回答 1

6

完全归功于此论坛帖子:http ://forums.accellera.org/topic/1002-uvm-print-with-array-objects/

UVMprint()接受一个uvm_printer参数。创建一个新uvm_table_printer对象( 的子对象uvm_printer),更改它的旋钮值,并将其传递给print()方法。

uvm_table_printer printer;
my_uvm_object m;

// ...

printer = new();
m = my_uvm_object::type_id::create("my_uvm_object");

printer.knobs.begin_elements = -1; // this indicates to print all
m.print(printer);

//Optionally you can specify numbers for begin/end
printer.knobs.begin_elements = 10; // prints the first 10; default: 5
printer.knobs.end_elements = 2; // also print the last 2; default: 5
m.print(printer);

当您希望通过覆盖该方法来影响特定的uvm_object可伸缩性时,这很有用。do_print()

或者,如果要进行全局更改,则会在根目录自动创建一个默认打印机,称为uvm_default_printer. 更改此打印机的旋钮值将更改使用默认值的所有打印件的打印行为。

uvm_default_printer.knobs.begin_elements=-1; // this indicates to print all
m.print(); // will print all elements

//Optionally you can specify numbers for begin/end
uvm_default_printer.knobs.begin_elements = 2; // prints the first 2; default: 5
uvm_default_printer.knobs.end_elements = 3; // also print the last 3; default: 5
m.print(); // will print the first 2 and last 3 elements

工作示例:http ://www.edaplayground.com/x/Ze

于 2014-02-11T20:45:50.743 回答