For the next release I am looking at adding RandTime. In some ways it is just a short hand for:
RV.RandInt(…) * 1 ns
Maybe this is the best way. What I see for the interface of RandTime is:
impure function RandTime (Min, Max : time) return time ;
impure function RandTime (Min, Max : time ; Unit : in time) return time ;
What is of concern is when units are not specified (or we use a default) should the default be ns, similar to write or should the default be the current simulation resolution? If you want direct control, you can use the overloading and specify the units.
I think I am leaning toward “ns” as default. Mainly for stability of testbenches since many RTL simulations use a simulator resolution of ns while gate level simulation use a resolution of ps. If we use simulator resolution, then testbenches will run differently when someone changes the defaults.
Once the above is resolved, I plan on adding overloading for:
-- shown using ns as default rather than sim_resolution
impure function RandTime (Min, Max : time ; Exclude: time_vector ; Unit: in time := ns) return integer ;
-- these do not require units
impure function RandTime (A: time_vector) return time ;
impure function RandTime (A, Exclude: time_vector) return time ;
Jim