Time background
time integer, - . , time_unit *. realtime, .
%t %d %f . $timeformat.
realtime capture = 0.0;
//To change the way (below) is displayed
initial begin
capture = $realtime;
$display("%t", capture);
end
%t:
//$timeformat(unit
$timeformat(-3, 2, " ms", 10); // -3 and " ms" give useful display msg
unit is the base that time is to be displayed in, from 0 to -15
precision is the number of decimal points to display.
"unit" is a string appended to the time, such as " ns".
minwidth is the minimum number of characters that will be displayed.
unit: recommended "unit" text
0 = 1 sec
-1 = 100 ms
-2 = 10 ms
-3 = 1 ms
-4 = 100 us
-5 = 10 us
-6 = 1 us
-7 = 100 ns
-8 = 10 ns
-9 = 1 ns
-10 = 100 ps
-11 = 10 ps
-12 = 1 ps
-13 = 100 fs
-14 = 10 fs
-15 = 1 fs
: realtime , $realtime %t .
, :
intial begin:
$timeformat(-9, 2, " ns", 10);
, , :
//Passed Prime check
time_s2 = time_s1; //Last Prime
time_s1 = $realtime ;
$display("Found %1d th Prime_1 %1d", k, count);
$display("Found at time : %t", time_s1);
$display("Time Diff : %t", time_s1 - time_s2);
EDA Playground.
*: verilog , time_unit , time integer .
`timescale <time_unit>/ <time_precision>
. 22.7 IEEE 1800-1012.