1. Alok Mandal
  2. SystemVerilog
  3. Sunday, 22 March 2020
hi guys,
i want to print the data in a table like below :


+------------+-------------------------+--------------------------+
| index | number | Description |
+------------+-------------------------+--------------------------+
| 1 | 12 | this is a long string |
| | | take two line |
+-------------+------------------------+---------------------------+
| 2 | 3456, | number is going to |
| | 68767687 | take two line |
+-------------+-------------------------+--------------------------+


data type of index and number is of int, for Description it is of string.

So basically here we are printing each of these in multilines, we can print string in multiline by using a method "

substr(i,j)
", but how can we do that for Int (number).
Responses (2)
Accepted Answer Pending Moderation
how to delete a post, where is that option :(
  1. more than a month ago
  2. SystemVerilog
  3. # 1
Accepted Answer Pending Moderation
You would need to represent integers as strings if you want it to be split. See the function itoa().

If you need to split into multiple lines, I guess you would first need to know the maximum characters you can put in a single column. But again this would also depend on the number of characters to pad i.e. the blank spaces between | and actual data.

If you are using UVM, you can probably get uvm_printer to print what you need in a much easier way.
  1. more than a month ago
  2. SystemVerilog
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!