summary: 12.13.3 random object stability code can be more accurate
description:
The following code could leave an impression only objects of different
classes have object stability, actually it's more important to point out
that
different instances of the same class have object stability.
Code below
class Foo;
rand integer x;
endclass
class Bar;
rand integer y;
endclass
initial begin
Foo foo = new ();
Bar bar = new();
integer z ;
void'( foo.randomize() ) ;
// z = $random ;
void' (bar.randomize() ) ;
end
should be changed to :
class Foo ;
rand integer x ;
endclass
class Bar ;
rand integer y ;
endclass
..
initial begin
Foo foo0 = new() ;
Foo foo1 = new() ;
Bar bar = new() ;
integer z ;
void'( foo0.randomize() ) ;
// z = $random ;
void'( foo1.randomize() ) ;
void' (bar.randomize() ) ;
end
the values foo0.x, foo1.x, and bar.y are independent of each other
and changing randomize() function calling order or adding $random call
won't change the values for foo0.x, foo1.x, and bar.y.
Received on Tue Aug 31 22:35:51 2004
This archive was generated by hypermail 2.1.8 : Tue Aug 31 2004 - 22:35:56 PDT