Valid args to randomize() Method

In reply to dave_59:

Hi Dave ,

Code 2 is addition from Ahmed Yehia’s Paper on Randomization .

**Object of class B will have 2 properties named ‘a’ .

I understand that Code 2 isn’t a correct Coding practice .

The intention is to try out various code to understand the LRM better .**

If I modify Code2 above to ::


B b1;

initial begin

b1 = new();

if ( b1.randomize() with {super.a == 3 ;} ) 
$display("Success with %p ",b1 );  

end

This works and it basically constraints the property ‘a’ inherited by class B to value 3

The Output would now be ::

Success with ‘{super:’{a:3}, a:2}

The 2nd ‘a’ has no constraint ( i.e any value b/w 0 to 3 )

With the modified code , how is that super::a works within an inline-constraint but
doesn’t work as an argument to randomize() method ?

As super.a is considered a variable , isn’t it considered a Valid argument to randomize() based on LRM ??