If we print the Transaction
class, it will not print our complete Array`s element which is inside the
Transaction class.
How to get the complete element printing of Arrays which is inside
Transaction class?
You can implement the below logic
in your uvm environment build phase to print the complete Array. Below I have
written a piece of code to print all element of array in the transaction class and
you can refer the same.
In the environment
file, Build phase
Uvm_default_printer = uvm_default_table_printer;
Uvm_default_printer.knobs.begin_elements = -1;
Then
we can use, wherever you want to use print call inside the environment.
For
example:
Print the transaction
class without enabling the array printer:
class Packet extends uvm_sequence_item;
rand bit [15:0] length;
rand bit [7:0] data[];
constraint payload_size_c { data.size inside { [1024 : 4096]};}
constraint length_c { length == data.size; }
function new(string name = "");
super.new(name);
endfunction : new
`uvm_object_utils_begin(Packet)
`uvm_field_int(length, UVM_ALL_ON|UVM_NOPACK)
`uvm_field_array_int(data, UVM_ALL_ON|UVM_NOPACK)
`uvm_object_utils_end
endclass : Packet
rand bit [15:0] length;
rand bit [7:0] data[];
constraint payload_size_c { data.size inside { [1024 : 4096]};}
constraint length_c { length == data.size; }
function new(string name = "");
super.new(name);
endfunction : new
`uvm_object_utils_begin(Packet)
`uvm_field_int(length, UVM_ALL_ON|UVM_NOPACK)
`uvm_field_array_int(data, UVM_ALL_ON|UVM_NOPACK)
`uvm_object_utils_end
endclass : Packet
module test;
Packet pkt1 = new();
Packet pkt1 = new();
pkt1.print();
endmodule
Output:
-------------------------------------------------------------------------------------------------------------------------
Name
Type
size Value
-------------------------------------------------------------------------------------------------------------------------
Pkt1
packet
- @10
Length integral 16 ‘h7D0
Data
da(integral)
2000 -
[0]
integral
8 ‘h51
[1]
integral
8 ‘h6b
[2] integral 8 ‘h66
…
…
… …
[1998] integral 8 ‘h15
[1999]
integral
8 ‘hA2
[2000] integral 8 ‘h5B
-------------------------------------------------------------------------------------------------------------------------
Print the transaction class after enabling the
array printer:
-------------------------------------------------------------------------------------------------------------------------
Name
Type
size Value
-------------------------------------------------------------------------------------------------------------------------
Pkt1
packet
- @10
Length integral 16 ‘h7D0
Data
da(integral)
2000 -
[0]
integral
8 ‘h51
[1]
integral
8 ‘h6b
[2]
integral 8 ‘h66
[3]
integral
8 ‘h51
[4]
integral
8 ‘h6b
[5]
integral
8 ‘h66
[6]
integral
8 ‘h51
[7]
integral
8 ‘h6b
[8]
integral
8 ‘h66
It will print all 2000 elements
-------------------------------------------------------------------------------------------------------------------------
With an above example you can
have a display the complete element in the array.
No comments:
Post a Comment