Hi Dave,
Can you please help on this?
class bus_seq;
rand bit queue_m[$];
rand bit [3:0] lsize;
constraint size_constriant {
lsize == 6;
queue_m.size() == lsize;
}
endclass : bus_seq
module randm();
bus_seq bs = new();
initial begin
$display(" --> initial queue_m = %p",bs.queue_m);
//option 1. this obviously works
//bs.randomize();
//option 2. this works , but I don't want for individual elements
//as elements are interdependent for later use
if (!bs.randomize() with {queue_m[0] == 1;
queue_m[1] dist {0 := 50, 1 := 50};
queue_m[2] dist {0 := 50, 1 := 50};
queue_m[3] dist {0 := 50, 1 := 50};
queue_m[4] dist {0 := 50, 1 := 50};
queue_m[queue_m.size()-1] == 0;})
$display("Randomize", "bs randomize() failed!!");
//option 3. I need help here, this is not working ! assigning whole queue elements ?
//I want to assigne whole queue as I want specific patterns - {1,0,1,0,1,0} or {1,1,0,0,1,0} or {1,0,1,1,0,0} or {1,1,1,0,0,0}
//bs.randomize() with {queue_m == {{1,0,1,0,1,0};} //this dont work
//bs.randomize() with {queue_m == {{1,0,1,0,1,0} or {1,1,0,0,1,0};} //this dont work, I actually want this kind of values with or condition?!
$display(" --> randomized queue_m = %p",bs.queue_m);
end
endmodule : randm
Thank you.