System timescale tasks |
LRM §14.3. |
System file I/O tasks are used for simulation time formatting.
$printtimescale [ (hierarchical_name) ]; $timeformat [ (unit, precision, "suffix", min_field_width) ];
$printtimescale displays the time scale of the specified module. When no hierarchical name is specified, it displays the time scale of the module that is in the current scope.
$timeformat defines the format used by the %t text format specifier. Unit is an integer between 0 and -15 and defines the base that time is to be displayed:
| 0 = 1 sec | -4 = 100 us | -8 = 10 ns | -12 = 1 ps |
| -1 = 100 ms | -5 = 10 us | -9 = 1 ns | -13 = 100 fs |
| -2 = 10 ms | -6 = 1 us | -10 = 100 ps | -14 = 10 fs |
| -3 = 1 ms | -7 = 100 ns | -11 = 10 ps | -15 = 1 fs |
Precision is the number of decimal digits to display. Suffix is a string appended to the time. Min field width is the minimum number of characters that will be displayed.
The defaults are used if no arguments are specified for $timeformat. The default unit is the simulation precision; precision is 0; suffix is the null string; min_field_width is 20 characters.
$printtimescale(top.u1); $timeformat(-9, 2 " ns", 15);