Skip to content

Instantly share code, notes, and snippets.

@morganp
Last active July 29, 2020 16:53
Show Gist options
  • Save morganp/1149187 to your computer and use it in GitHub Desktop.
Save morganp/1149187 to your computer and use it in GitHub Desktop.
Verilog time format
//To change the way (below) is displayed
$display("%t", $realtime);
//$timeformat(unit#, prec#, "unit", minwidth);
$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.
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
//Source
//http://www.sutherland-hdl.com/online_verilog_ref_guide/vlog_ref_top.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment