 |
|
|
|
|
|
|
|
|
|
|
|
|
SVUG Community Forum
|
|
| Author |
Messages |
|
Brinda
Posts:1
 |
| 09/23/2009 5:08 PM |
|
Hi, How can I get a variable delay in with a time unit in SV?
if you have delay = $urandom_range(min,max), one cannot include the time unit here. Is this a language limitation?
Currently you can use delay = $urandom_range(min,max) and specify the time unit when invoking the sim, but that does not seem to be the best solution because if someone changes the time unit during invocation then there can be problems.
Any suggestions/ideas are welcome.
Thanks!
|
|
|
|
|
karthik
Posts:12
 |
| 11/15/2009 7:42 AM |
|
In SV, you can specify time unit in the delay specification.
ex: delay = $urandom_range(max, min);
#(delay)ns;
______________ Thanks & Regards, Karthik
www.nusym.com
|
|
|
|
|
DAVE
Posts:56
 |
| 11/15/2009 10:05 AM |
|
The only place you are allowed add a ns or other unit is on a time literal, e.g. 123ns.
The time precision only scales values in places that are recognized as delays. So if you want to store a delay in a variable (including a time variable), you have to decide what scale the value of that variable represents. Then when you use that variable in a delay expression, multiply it by the unit it represents.
delay = $urandom_range(min,max); // this value is in ms #(delay *1ms);
Dave
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|
|
|

|
|
|
|
|
|
|
|
|
|
 |
|