Correct! I was solving for a problem which had 10 consecutive ones. Thanks for correcting
I tried the above problem as follows:
class abc;
rand bit[31:0] addr;
rand bit[31:0] shift;
constraint addr_c{
shift inside {[1:16]};
addr == 10'b1111_1111_11 << shift;
}
function void post_randomize();
addr = ~addr;
$display("arr == %b shift =%0p", addr, shift);
endfunction
endclass: abc
module tb;
abc abc_inst;
initial begin
abc_inst = new();
repeat(10)
abc_inst.randomize();
end
endmodule