Get system time in VCS

Jean picture Jean · Sep 25, 2014 · Viewed 7.4k times · Source

Is there way to get system time in VCS/UVM ? I am looking for something similar to Perl's localtime(time). Is there way to print system time for every uvm_info printed ?

Answer

Ari picture Ari · Sep 25, 2014

One way is to use $system() to run any system command, including system' date command.

initial
 begin
    $system("date");
 end

From IEEE 1800 LRM:

$system makes a call to the C function system(). The C function executes the argument passed to it as if the argument was executed from the terminal. $system can be called as either a task or a function. When called as a function, it returns the return value of the call to system() with data type int. If $system is called with no string argument, the C function system() will be called with the NULL string.

Also, see here.