Re: [sv-bc] time literals

From: Steven Sharp <sharp_at_.....>
Date: Fri Sep 07 2007 - 17:38:54 PDT
>Can one write:
>
>realtime td = 1.2345ns;
>
># td; // as near a 1.2345ns delay as possible

I believe so.  In fact, I believe that a time literal is just a
fancy way of specifying a real literal number and can be used
anywhere a real literal can be used.  It is not restricted to
use in delays at all, though that is obviously where it is most
useful.

If the local timeunit is 1ns, then 1.2345ns is equivalent to the
real literal 1.2345.  If the timeunit is 100ps, then 1.2345ns
is equivalent to the real literal 12.345.

It has no special data type.  It is just a real number whose
value has been determined by taking the numeric part of the
literal and scaling it by the attached unit and the local
timeunit.

Note that if the #td is used in a module with a different
timeunit than the one where the assignment of 1.2345ns appeared,
then it may not produce a delay close to 1.2345ns.  For example,
if the assignment is in a module with a timeunit of 100ps, then
the value of td will be 12.345.  If that is used in a module with
a timeunit of 1ns, then it will have the same effect as any other
use of #12.345 there, which will be a delay of 12.345ns.

There was some discussion of the possibility of adding a special
time type that carries units with it.  A value of such a type
could scale to the same delay (aside from timeprecision rounding)
independently of the local timeunit where it was used.  Rules
would have to be added for how this type worked, which is why
it has not been done.  It could still be done, with some care to
maintain backward compatibility with the current behavior of time
literals.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Sep 7 17:59:34 2007

This archive was generated by hypermail 2.1.8 : Fri Sep 07 2007 - 18:00:18 PDT