In section 12.7 the 'rand_mode' method is defined.
The 8th paragraph states:
If the random variable is an object handle, only the mode of the
variable is changed, not the mode of random variables within that object
(see global constraints in Section 12.4.8).
However, just below that, the example and text contradict the above
statement.
Example:
class Packet;
rand integer source_value, dest_value;
... other declarations
endclass
int ret;
Packet packet_a = new;
// Turn off all variables in object
packet_a.rand_mode(0);
// ... other code
// Enable source_value
packet_a.source_value.rand_mode(1);
ret = packet_a.dest_value.rand_mode();
This example first disables all random variables in the object packet_a,
and then enables only the source_value variable. Finally, it sets the
ret variable to the active status of variable dest_value.
So in the example, what is the correct value for 'ret' ?
- Ray
Received on Thu Dec 9 10:37:52 2004
This archive was generated by hypermail 2.1.8 : Thu Dec 09 2004 - 10:37:55 PST