It is often very useful to constraint fields of classes to be equal to a value or in a certain range, as well as the opposites of the previous two. These can be provided by the library:
class some_class;
rand int some_int_field;
rand some_enum_e some_enum_field;
`constraints_infrastructure_begin(some_class)
`constraints_field(int, some_field)
`constraints_field(some_enum_e, some_enum_field)
`constraints_infrastructure_end
endclass
It is often very useful to constraint fields of classes to be equal to a value or in a certain range, as well as the opposites of the previous two. These can be provided by the library:
This would define the following factory methods:
and the same for
some_enum_field
.