hi,
timescale 1ns/1ps
$timeformat(-9, 3, "ns", 8);
class my_seq;
realtime p1;
realtime p2;
real t1,t2;
....
//when the simulation time is 10.3ns;
p1 = $realtime;
...
// when the simulation time is 11ns;
p2 = $realtime;
t1= real'(p1);
display("p1=%t",p1);
display("p2=%t",p2);
display("t1=%d",t1);
display("t1=%d",t2);
endclass
the print result is
p1=10.300 ns
p2=11.000ns
t1= 10300
t2 = 11000
why t1 is not 10.300 but 10300?
how can i convert realtime type data p1 into real type t1 which is equal to the value when the timeunit is ns and precision is ps.
thank you .