RE: [sv-ec] rand modifier on handle to null

From: Ryan, Ray <Ray_Ryan@mentor.com>
Date: Mon Feb 22 2010 - 11:34:49 PST

In section 18.4 Random variables, the 5th bullet contains:
    "-- ... When a dynamic array is resized by randomize, ... If the new
size is greater than the
original size, each of the additional elements has a null value
requiring no randomization."
 
This implies that a random variable with a null value does not cause an
error.
 
I do agree the LRM could be more explicit.
 
Ray

________________________________

        From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf
Of Daniel Mlynek
        Sent: Monday, February 22, 2010 5:41 AM
        To: sv-ec@eda.org
        Subject: [sv-ec] rand modifier on handle to null
        
        
        LRM does not say explicitly what should happened if handle
pointing to null is randomized.
        See below case - there are 2 calls to randomize (1 to method 1
to function).
        In both calls handle to null is randomized.
        Should it be "null pointer reference" fatal error or randomize
function (method) should automatically ignore null references?
        IMHO LRM should explicitly describe proper behaviour.

                class A;
                    rand int i ;
                endclass
                 
                class C;
                   rand A a = null;
                endclass
                 
                module top;
                    C c = new;
                    C c0;
                    initial begin
                        c.randomize(); //
                        randomize(c0); //c is null
                    end
                endmodule
                

        DANiel

        --
        This message has been scanned for viruses and
        dangerous content by MailScanner <http://www.mailscanner.info/>
, and is
        believed to be clean.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Feb 22 11:35:11 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 22 2010 - 11:35:23 PST