Reply To: RandSlv failes silently on large vectors

Why OSVVM™? Forums OSVVM RandSlv failes silently on large vectors Reply To: RandSlv failes silently on large vectors

#611
Jim Lewis
Member

Hi Trond,

Lets first scope the problem so others reading this do not get concerned over the rest of the library.  For calls to RandSlv, RandUnsigned, and RandSigned with only one parameter, the size (number of bits in the number), there is no internal error checking for values being out of integer range.  Calls, such as the one below, that use a valid range for integer values 1 to 31 bits for std_logic_vector and unsigned, or 1 to 32 bits for signed work fine.

RandVal :=  RV.RandSlv(5) ;

This is equivalent to:

RandVal := RV.RandSlv(0, 31, 5) ;

Values outside of this range may or may not produce an error message depending on how the simulator represents a value outside of the normal integer range.  So the following is an issue.  Note this is asking for a random value within a 1024 bit number. 

RandVal := RV.RandSlv(2**10) ;  

Have you tried this using 2013.04?  I added better error checking to primary randomization functions.  Whether it detects an issue at this point may be simulator dependent.  I will let you know what I see when I finish testing.  It would help me if you send me an email with which simulator you are using (jim at synthworks dot com).   

The other question is, what to do about it?  My first thought was add bounds checks and make values larger than integer illegal.  However, for full range values, it would also be straight forward to use multiple randomizations to create the value.  

Best Regards,

Jim