Generate a number which has sequence 11101

In reply to abhiverif:
This worked for me:

constraint c { value == (pattern << position);
                position inside {[1:32]};};

Dave,
Can you please help me understand this:
parameter mask = {$bits(pattern){1’b1}}; //This means you are making the mask: 5’b11111 right … I am not understanding your constraint, can you please explain with a small example on what it is trying to do.

   constraint c { (value & (mask << position)) == (pattern << position);
     position <= $bits(value)-$bits(pattern);}

//when you says $bits(value) ,does it refer to the value of the 32 bit variable “value”.