Using system functions : $realtime and $time as arguments to format specification %t

In reply to dave_59:

the default is to scale the formatted time to the global time precision

Yes , I do get this part . As Chris pointed it’s the default $timeformat in work .

I wanted to confirm if the following is correct :


Since %t is used to display time / simulation time , the argument to it ( $realtime ) is first scaled to time unit via : ( 1.5 / 4.1 / 5.6 )  x  10ns .

Then the result is scaled to global time precision .

If the argument to %t is real variable / parameter :


  `timescale 10 ns / 1 ns 
   module top;
   parameter  param = 1.9890 ;

   initial  $display(" param is %0t " , param );
   endmodule

In this case the parameter would be first scaled to time unit to calculate simulation time i.e 1.9890 x 10ns i.e 19.890ns
Then the result is scaled to global time precision i.e 20ns .
As a result we observe 20 in output ( no ns since default value of argument suffix_string is “” )



EDIT : After scaling the simulation time to a precision based on argument ' units_number ' of $timeformat ,  
       the equivalent result is rounded-off as per argument ' precision_number ' of $timeformat