[sv-ec] soft constraints and .size randomization

From: Daniel Mlynek <danielm@aldec.com.pl>
Date: Mon Feb 09 2015 - 03:52:51 PST
See example:

    class D;
         rand bit[2:0] arr[]='{1,2};
        rand int a=1,b=10;
         constraint con1 { soft arr.size < a && arr.size > b; }

    endclass

    D d = new;

    module top;
         initial repeat(10) begin
                //d.arr = new[5];
            // d.con1.constraint_mode(0); d.con2.constraint_mode(0);
             assert(d.randomize() with {a<b;}) else
    $fatal("Randomization failed.");
             $display("%p",d.arr);
         end
    endmodule


LRM is not clear what should happen in such case.
"arr" size should not be randomized because soft constraints con1 is 
discarded by inline constraint.
or
"arr" size should remain to be random but constrain on it should be removed



DANiel


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Feb 9 03:53:10 2015

This archive was generated by hypermail 2.1.8 : Mon Feb 09 2015 - 03:53:25 PST