HI All,
I am trying to generate the odd numbers in an ascending order in this format
1 3 5 7 9 11…
basically, the difference between each two element is exactly two.
I am getting randomization failure, could you please suggest?
Thank you,
module m1;
class packet;
rand bit [3:0] array[2][3];
constraint c2{
foreach(array[i,j])
if(i==0 && j==0)
array[i][j]==1;
else
array[i][j]==array[i][j]+2;
}
function void post_randomize();
$display("%0p", array);
endfunction
endclass
packet pkt;
initial begin
pkt = new;
repeat (1) begin
pkt.randomize();
end
end
endmodule