Jump to content

Recommended Posts

Posted

Hello,

When I print topology or transactions with arrays, it prints the 1st 5 and the last 5 array elements if the array is big. This is good most of the time. Once in a while, I would like to see the whole array elements. Is there a way to control the size of arrays to be displayed?

Thank you!

Posted

Hello, You are able to control the size of the arrays printed via the table printer by using the printer knobs.

For example,

uvm_table_printer printer;

printer = new();

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

Optionally you can specify numbers for begin/end

printer.knobs.begin_elements = 10;

printer.knobs.end_elements = 2;

Then when you print - you use the print(printer) command.

I hope this helps.

Kathleen

Posted

Hi Kathleen,

Thank you for your response. I suppose I should apply the code in the class where print function is getting used? What is the easiest way to apply this to all in the environment?

Thank you!

Posted

Hi,

I think you can do this in your test class or your testbench class or the top module.

I tried a simple example in a top module but I'm pretty sure it will work in the test or env:

initial begin

uvm_default_printer = uvm_default_table_printer;

uvm_default_printer.knobs.begin_elements=-1;

...

packet.print();

end

This seemed to work fine. Let me know if it does not work for you and I can create a simple example using a test class (or a env).

Kathleen

Posted

OK - I tried it in my base test.

function void start_of_simulation_phase(uvm_phase phase);

super.start_of_simulation_phase(phase);

// Setting default printer info

uvm_default_printer = uvm_default_table_printer;

uvm_default_printer.knobs.begin_elements=-1;

...

In this case - when I printed a packet anywhere in the design it printed everything.

Kathleen

Posted

This will always work in a .log file or a directed file (based on a knob value) -- but it doesn't work when viewing transactions in the waveform windows. I also do not know if this works in the stripe chart window. I think we can't change the behavior in the GUI windows, but it will ALWAYS be displayed fully in the .log or other files. To redirect to other than the default simulator output file, you need to change .knobs.mcd to change the file pointer:

mcd

int mcd = UVM_STDOUT

This is a file descriptor, or multi-channel descriptor, that specifies where the print output should be directed.

By default, the output goes to the standard output of the simulator.

I think currently, you can't change the transactions in the GUI windows (waveforms and Transaction strip chart) -- it will always default to 5 first and the 5 last. I'll try it and report back

  • 4 years later...
Posted

another approach may look like this:

function void do_print(uvm_printer printer);

    foreach( array ) begin

       printer.print_object("entry", array);

       if( i == NUMBER_OF_ENTRIES_TO_PRINT)  break;

    end

endfunction

  • 5 months later...
Posted
On 12/21/2012 at 7:23 AM, lisakb1963 said:

I think currently, you can't change the transactions in the GUI windows (waveforms and Transaction strip chart) -- it will always default to 5 first and the 5 last. I'll try it and report back

 

You can do something like as shown below. It works fine in Simvision waveform browser.

For example, if you have packet class extended from uvm_sequence_item in which you declared a data item rand bit [9:0] payload[];
and then for this data item, you shall have a field automation macro with the following trick 

`uvm_field_array_int(payload, UVM_ALL_ON | UVM_NORECORD)
// UVM_NORECORD will exclude the field in vendor-specific transaction recording.

You need to define a function as shown below inside this class

virtual function void do_record( uvm_recorder recorder );
    super.do_record( recorder );
    foreach (payload)
      recorder.record_field($sformatf("payload[%d]",i),payload,10,UVM_NORADIX);
  endfunction: do_record
 

You will be able to see a transaction in which payload will have all of its elements.

Hope this will help!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...