Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use $time in verilog?

11,654 views
Skip to first unread message

hsr...@my-deja.com

unread,
Apr 24, 2000, 3:00:00 AM4/24/00
to
Hello,

Could anybody help me as how to use $time in verilog.

I need a timestamp of start of some event and the end of the same.
for instance.

The timestamp should start at the rising edge of a signal called UP and
should end at the rising edge of the other signal DOWN.

The time is actually the diffrence between DOWN - UP.

Please help me.

Hari.


Sent via Deja.com http://www.deja.com/
Before you buy.

Xanatos

unread,
Apr 24, 2000, 3:00:00 AM4/24/00
to
<hsr...@my-deja.com> wrote in message news:8e1s4r$psg$1...@nnrp1.deja.com...

> Hello,
>
> Could anybody help me as how to use $time in verilog.
>
> I need a timestamp of start of some event and the end of the same.
> for instance.
>
> The timestamp should start at the rising edge of a signal called UP and
> should end at the rising edge of the other signal DOWN.
>
> The time is actually the diffrence between DOWN - UP.
>
> Please help me.
>
> Hari.
>
Hari,

This should get you started....

@(posedge UP) $display("%0t : UP", $time);
@(posedge DOWN) $display("%0t : DOWN", $time);

Cheers,
Xanatos

igla...@my-deja.com

unread,
Apr 24, 2000, 3:00:00 AM4/24/00
to
Hi,

Just a small addition, incase you don't want to diaplay you can
store the $time and make your own calculation

e.g. if you want to check the ck->out of output signal name sig you can
do something like:

integer clk_time, sig_time, sig_ck2o;

always @ (posedge clk)
clk_time = $time;

always @ (sig)
begin
sig_time = $time;
sig_ck2o = sig_time - clk_time ;
$display ("%0t SIG Have CK->Q of %d ns",$time,sig_ck2o);
end

etc

have a nice day

Illan

In article <AY_M4.143622$1C2.3...@news20.bellglobal.com>,

Utku Ozcan

unread,
Apr 25, 2000, 3:00:00 AM4/25/00
to
And my recommendation is to use $timeformat system task. Whenever
you print the time with $time and %t into the stdout, normally you
don't see the timeunit. $timeformat enables you to scale your time
value. $timeformat must be used in a separate initial:

initial
begin
$timeformat ("-9, 0, " ns.", 5);
end

...where -9 is unit (here unit is ns.), 0 is precision after
".", the string " ns." is appended at each %t printing. 5 is
the minimum string length to print the time information.

Utku

--
I feel better than James Brown.

igla...@my-deja.com

unread,
Apr 25, 2000, 3:00:00 AM4/25/00
to
Hi,

I myeslf prefare the %0t on %t .

have a nice day

Illan

In article <39053117...@netas.com.tr>,

Utku Ozcan

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
>
> I myeslf prefare the %0t on %t .
>
> have a nice day
>
> Illan

I also use %0t, also %0h, %0d. But still no workaround for
hexadecimal formatting for capital letters!!

igla...@my-deja.com

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
Hi,

Any specail reason why I would like the hex to be capiatal letter ?

maybe in 20 years from now when my eye sight want be as good but except
for that ?

Have a nice day

Illan

In article <390680A4...@netas.com.tr>,

Thomas C. Jones

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
It helps when you're comparing with other data written in all caps. ~Tom

igla...@my-deja.com

unread,
Apr 27, 2000, 3:00:00 AM4/27/00
to
Hi,

Assuming you use diff than just use diff -i

Have a nice day

Illan

In article <3907760C...@sebringring.com>,

igla...@my-deja.com

unread,
Apr 27, 2000, 3:00:00 AM4/27/00
to
Hi,

Assuming you use diff than just use diff -i

or you can also use tr 'a-f' 'A-F'

Message has been deleted
Message has been deleted
0 new messages