Search code examples
verilogsystem-veriloguvmsynopsys-vcs

Get system time in VCS


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 ?


Solution

  • 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.