UVM prints not printing time value after decimal point

Hi All,

Describing the issue below,
Current print format,
UVM_INFO @ 25687.000ns: reporter [SOME PRINT] Print example 1
UVM_INFO @ 25687.000ns: reporter [SOME PRINT] Print example 2

UVM_INFO @ 25688.000ns: reporter [SOME PRINT] Print example 10
Query : How to enable time print after decimal like 25687.156ns in my UVM testbench.

Thank you very much!

In reply to stanley_sam:

Here’s a simple example
I had this code in my UVM test

 // declaration
 my_real_num = 12345.678;

// printing 
 `uvm_info(get_type_name(),$sformatf("My Real Number Value = %5.3f ",my_real_num),UVM_MEDIUM)

and this is what I get in the simulator transcript:

UVM_INFO @ 0.000ns: uvm_test_top [test_top] My Real Number Value = 12345.678

In reply to graeme_jessiman:

Thanks for your inputs…
Actually issue is not with printing inside UVM info by %f format.
As per you example will elaborate my query,
uvm_info @ 0.000ns,
Here .000ns in your case might be correct for zero time simulation but when we long simulation tests, this .000ns does help as the UVM_ERROR prints 5000.000ns but actual error in waveform occurred at 5000.525ns.
Hope this could be helpful to understand this issue.

In reply to graeme_jessiman:

and to print the time, you can use :

 `uvm_info(get_type_name(),$sformatf("The time is %0t ns",$time), UVM_MEDIUM)

which gives you:

UVM_INFO @ 0.000ns: uvm_test_top [test_top] The time is 0.000ns ns

In reply to graeme_jessiman:

But can’t we change the time print of UVM_INFO @ 0.000ns?? instead of writing %t in every $format?

In reply to stanley_sam:

The issue is not with the format for printing, but rather the time precision in the scope where the delay appears. The actual delay is being rounded to the time precision, and the uvm_info is printing the value returned by $realtime formatted by %t.

module top;
  timeunit 1ns;
  timeprecision 1ps;
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  
  initial begin
    $timeformat(-9, 3, " ns", 10);
    #25687.156 `uvm_info("SOME PRINT","Print example 1", UVM_LOW)
  end
endmodule

This displays

# UVM_INFO testbench.sv(11) @ 25687.156 ns: reporter [SOME PRINT] Print example 1

but if I change the time precision to 1ns ( or by using `timescale), it displays

# UVM_INFO testbench.sv(11) @ 25687.000 ns: reporter [SOME PRINT] Print example 1

The value returned by $realtime has been rounded before $display even begins to format it.

In reply to dave_59:
Thank you Dave. As always!