In reply to to_learn_uvm:
Quote:
In reply to Rahulkumar Patel:
@rahulkumar,
I have updated the question. Why I want this constraint? - because I want to generate other data type value based on this int range. say if array index is less than 10,dont randomize the array, if its greater, rndomize it. But the user passes the range as class parameter.
You cant randomize the parameter value of a class, it must be a constant.
Instead of creating class parameter, why don't you create the rand variable in abc class?
class abc extends uvm_sequence_item;
rand int range;
endclass
Then randomize the abc class object:
abcd item = new;
item.randomize() with {
range == 4; // Or any value you want.
};
You can also add a constraint of range variable in abc class.