Hi Dave,
I was trying to randomize an integer variable for 10 iterations in ascending order using the constraint you mentioned in the post dated Nov 28th. Following is the code:
module top;
class rand_ex;
rand int unsigned b;
constraint c1 {b > const'(b) ;}
endclass
rand_ex r1;
initial begin
r1 = new();
for (int j=0; j<10; j++) begin
assert (r1.randomize());
$display ("Iteration_number:%0d b:%0d", j, r1.b);
end
end
endmodule
I get this compilation error: Const cast for expressions is only supported in procedural assertions
Tool:Questasim
Your feedback on this would be much appreciated. Also please help me understand as to how does the constraint “b > const’(b)” imply variable b of the current iteration should be greater than in the previous iteration.
Thanks and Regards,