[sv-ec] dist operator and negative value used as weight

From: Daniel Mlynek <danielm@aldec.com.pl>
Date: Tue Sep 06 2011 - 06:09:54 PDT

LRM defines only how should dist behave is 0 is used as weigth.
What should happen if wigth expression is negative?
IMHO it should be an error

    module top;
         int a;
         bit b;
         int arr[int];
         initial begin
             repeat (100)begin
               b=std::randomize (a) with {
                   a dist {
                    1:=2,
                    5:=-1, //<<negative
                    10:=0,
                    100:=1
                 };
               };
               arr[a]++;
             end
             foreach (arr[i])
              $display( i, arr[i]);
         end
    endmodule

There can be more complicated cases as weigth can be a variable or
parameter.

DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Sep 6 06:09:34 2011

This archive was generated by hypermail 2.1.8 : Tue Sep 06 2011 - 06:09:36 PDT