jdshah
Junior Member level 3
Code:
class Base;
rand integer vari;
constraint range { 0< vari < 100 ;}
endclass
module test;
Base objh =new();
initial
begin
if(objh.randomize())
begin
$display(" Randomization is done ");
end
$display(" objh.baseh.vari : %d ", objh.vari );
end
endmodule
Output : objh.vari : 1245020823
My question is constraint did not failed, but value did not generated as per constraint. Why?
The reason I find out is, this happened as constraint are declarative. But I did not understood the reason. Can anyone explain?