Printing table type format in systemverilog log file

Hi All,

I want to print packet fields in table format. I tried using display statement, but data was not aligned. Please let me know how to do this.

Thanks,
Rahul Kumar

Are you using the UVM? There is a uvm_table_printer class to help with this. If not, you should be. :)

In reply to dave_59:

Hi Dave,

Thanks for reply. I am not using UVM, Is there any way to do this in simple systemverilog TB.

In reply to Rahul Kumar khokher:

Since you are not using a standard methodology, you will have do this manually by adding the appropriate spaces and using % width specifications in your $display statements.

Sometimes, if for nothing else, you can use the UVM reporting and printing methods alone without having to learn anything else.

In reply to dave_59:

how can i use $dislplay (or something else in OVM) to print a string with place holding
i know in c its like this:
printf(“%-6s”, string_s);

for example i have those vars:

string a = "kuku"
string b = "kukuku"

i want it to be displayed like this (6 characters) :

---------kuku  ---------
---------kukuku---------

thanks!

In reply to gotlibhaim:

the page clean the spaces in the first print example
hope you’ll understand my question

In reply to gotlibhaim:
Please use code tags to format your code in this forum. I have done that for you.

SystemVerilog has %6s that gives you minimum width right justified formatting. Some simulators have already implemented %-6s to get left justified. Neither format specifier truncates if the string is more than 6 characters.

In reply to dave_59:

ok, i’ll.

so if

"%-6s"

dosn’t work 4 me it’s an IT issue…
thanks!