RandSlv failes silently on large vectors

Why OSVVM™? Forums OSVVM RandSlv failes silently on large vectors

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #607

    As you’re aware of there is a limitation in OS-VVM due to the nature of integers in VHDL. I notice that RandSlv failes silently for certain inputs. I’ve crafted a trivial testcase to trigger this bug: https://dl.dropboxusercontent.com/u/18844932/test_osvvm_RandSlv.vhd

    #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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.