Hi All,
I want to create one array to store the real value also I want to randomize it. My intention is to create an array which can store real values and then picking out unique value out of range say 10 to 12 and value could be 10.2, 10.5, 11.5, 11.7 and so on… but that should be a real value. So far I was able to implement everything but I don’t know how should I declare my array as real and rand.
class packet;
rand bit [5:0] a[] ; // Here I want to use the type as real something like as rand real bit [5:0] a[];
constraint c1 { a.size()==10;
}
constraint c2 { foreach (a[i])
a[i] inside {[10:12]};
}
constraint c3 { unique {a};
}
function void display();
$display("Values are:%p", a);
endfunction
endclass
module tb;
packet pkt;
initial begin
pkt = new();
pkt.randomize();
pkt.display();
end
endmodule
Thanks and Regards