Reply To: Usage of random functions (e.g RandSlv)

Why OSVVM™? Forums OSVVM Usage of random functions (e.g RandSlv) Reply To: Usage of random functions (e.g RandSlv)

#1082
Jim Lewis
Member

Hi Eilert,

The only issue with functions and procedures of this sort is if they are called from more than one process.  When two processes share a common seed and randomize at the same time, the test will be unstable – meaning if you recompile the test, the processes may call the function/procedure in a different order (due to both requesting it during the same delta cycle and optimization changing which one gets scheduled first), and as a result the test will produce different results than it did previously.

Hence, this is why I suggest passing the randomization object into the procedure instead.  Unfortunately when you pass in the protected type, a function is no longer possible.

Cheers,

Jim