Hi,
I want to print the current time of simulation using $realtime.
For e.g.
Let my current simulation timestamp is 96571495 (unit is ps).
When I try to print it as :
$display($realtime);
It prints value : 96571000
How to fix it?
Hi,
I want to print the current time of simulation using $realtime.
For e.g.
Let my current simulation timestamp is 96571495 (unit is ps).
When I try to print it as :
$display($realtime);
It prints value : 96571000
How to fix it?
Use timeformat:
...
$timeformat(-9, 3, "ns", 8);
//$timeformat params:
//1) Scaling factor (–9 for nanoseconds, –12 for picoseconds)
//2) Number of digits to the right of the decimal point
//3) A string to print after the time value
//4) Minimum field width
$display("%t", $realtime);
In reply to svru:
SystemVerilog always scales and rounds the result of $realtime to the local timescale and precision. You need to make sure the time precision of the module, package, or interface where the $display is located is in ps.
Hi Sir
I have one doubt in uvm timescale method
i am used the run command in 1ns/10ps so print the value in 10ps.so i can’t understand the ns value
task tCSP_timing_check;
@(negedge mon_if.CE_N);
x1=$realtime;
`uvm_info(get_full_name(),$sformatf("x1:%t",x1),UVM_LOW);
@(posedge mon_if.CLK);
x2=$realtime;
//`uvm_info(get_full_name(),$sformatf("x2:%t",x2),UVM_LOW);
tcsp=x2-x1;
//@(posedge clk);
//$display($realtime,"tcsp:%t",tcsp);
`uvm_info(get_full_name(),$sformatf("tcsp:%t",tcsp),UVM_LOW);
if(tcsp>=tCSP)begin//2ns
//$info("CE_N setup realtime to clk rising edge is crt");
`uvm_info(get_full_name(),$sformatf("CE_N setup realtime to clk rising edge is crt"),UVM_LOW);
end
else begin
//$error("CE_N setup realtime is violation");
`uvm_error("tCSP_Error","CE_N setup realtime is violation");
end
endtask
In this task how to print in $timeformat method to print ns value
Hi Sir,
I have used 1ns/10ps. I want the values to be printed in ps and I can see only ns values.
Please explain me were I am wrong
I have also made changes as per your guidelines
In reply to baladevi:
Hi,
//if you want to print the value in the ns:
$timeformat(-9, 3, "ns", 8);
//$timeformat params:
//1) Scaling factor (–9 for nanoseconds, –12 for picoseconds)
//2) Number of digits to the right of the decimal point
//3) A string to print after the time value
//4) Minimum field width
//if you want to print the value in the ps:
$timeformat(-12, 3, "ps", 8);