For UVM objects using `uvm_field_queue_int
utility macro, UVM does not print out the whole queue when calling 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
# -----------------------------------------
What's the best way to have UVM print the whole queue?
The example code on EDA Playground: http://www.edaplayground.com/x/rS
Full credit goes to this forum post: http://forums.accellera.org/topic/1002-uvm-print-with-array-objects/
The UVM print()
accepts an uvm_printer
argument. Create a new uvm_table_printer
object (child of uvm_printer
), change it knobs values, and pass it to the print()
method.
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);
This is useful when you want to affect the with in a particular uvm_object
can can be made scalable by overriding the do_print()
method.
Alternatively, if the change is intended to be global, there is a default printer that automatically created at root called uvm_default_printer
. Changing the knob values of this printer will alter the printing behavior of all prints using default.
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
working example: http://www.edaplayground.com/x/Ze